From: "David A. Black" Date: 2005-10-28T22:49:15+09:00 Subject: Re: append_feathers --8323328-533281857-1130507344=:4288 Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-533281857-1130507344=:4288" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-533281857-1130507344=:4288 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Hi -- On Fri, 28 Oct 2005, Brian Schr=F6der wrote: > On 27/10/05, David A. Black wrote: >> Hi -- >> >> I just accidentally typed "append_feathers" instead of >> "append_features" in something I was writing. I thought maybe this >> would be of use to those of you who are fond of nomenclature drawn >> from the mallard sphere :-) >> >> >> David >> >> -- >> David A. Black >> dblack@wobblini.net >> >> > > --- > module Kernel Probably better to put it in Module. > def append_feathers > class_eval do > def fly > =09if %w(Penguin Dodo).include?self.class.to_s Or: if [Penguin, Dodo].include?(self.class) though testing for class ancestry is kind of unducklike, isn't it? :-) > =09 raise "I can't fly" > =09else > =09 puts "flap flap flap" > =09end > end > end > end > end > > class Duck > append_feathers > end > > class Dodo > append_feathers > end > > Duck.new.fly > Dodo.new.fly > --- > > I hope I got the scopes right. And now let's see whether upgrading pine will cause my reply to you not to be all weird like they were in the past.... :-) David --=20 David A. Black dblack@wobblini.net --8323328-533281857-1130507344=:4288-- --8323328-533281857-1130507344=:4288--