append_feathers

D

David A. Black

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
 
S

Sean O'Halpin

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 :)

Let's just hope this doesn't result in another slew of fowl puns.

Sean
 
H

Hugh Sasse

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 :)

That would be the frictionless spherical mallard?
Hugh
 
J

JB Eriksson

------=_Part_3274_7799675.1130441118821
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

was it featherless because it was frozen?

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

------=_Part_3274_7799675.1130441118821--
 
R

Robert Klemme

JB said:
was it featherless because it was frozen?

LOL - thanks for making my day!

Now, who files the RCR for "make append_feathers an alias for
append_features"?

Chuckle

robert
 
B

Brian Schröder

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

---
module Kernel
def append_feathers
class_eval do
def fly
=09if %w(Penguin Dodo).include?self.class.to_s
=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.

cheers,

Brian
 
D

David A. Black

--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 --


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

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
(e-mail address removed)
--8323328-533281857-1130507344=:4288--
--8323328-533281857-1130507344=:4288--
 
H

Hugh Sasse

---559023410-650320721-1130508400=:19167
Content-Type: MULTIPART/MIXED; BOUNDARY="-559023410-650320721-1130508400=:19167"

This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.

---559023410-650320721-1130508400=:19167
Content-Type: TEXT/PLAIN; charset=X-UNKNOWN
Content-Transfer-Encoding: QUOTED-PRINTABLE

Hi --
=20
On Fri, 28 Oct 2005, Brian Schr=F6der wrote:
=20
=20
Probably better to put it in Module.

"Head First Design Patterns"[1] suggests the Strategy pattern for
exactly this application (the flight and quacking of Ducks and other
birds).
=20
=20
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.... :)
=20
=20
David
=20
Hugh

[1] http://www.oreilly.com/catalog/hfdesignpat/index.html
Head First Design Patterns
By Eric Freeman, Elisabeth Freeman, Kathy Sierra, Bert Bates
First Edition October 2004=20
Series: Head First
ISBN: 0-596-00712-4
676 pages,


---559023410-650320721-1130508400=:19167--
---559023410-650320721-1130508400=:19167--
 
B

Brian Schröder

Hi --


Probably better to put it in Module.
def append_feathers
class_eval do
def fly
if %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? :)

Oh, thats true. I wanted to escape the problem of undefined constants,
but they will pop in existence here. Too much thinking on my part :-(

cheers,

Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,184
Messages
2,570,979
Members
47,579
Latest member
CharaS3188

Latest Threads

Top