On 27/10/05, David A. Black <dblack / wobblini.net> 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
  def append_feathers
    class_eval do
      def fly
	if %w(Penguin Dodo).include?self.class.to_s
	  raise "I can't fly"
	else
	  puts "flap flap flap"
	end
      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

--
http://ruby.brian-schroeder.de/

Stringed instrument chords: http://chordlist.brian-schroeder.de/