Hi all,

Quick question: is there a better way to write Foo.contains below?
Forcing the lexical scoping like this feels wrong.

class Foo
  def self.contains *o
    @contents ||= []
    @contents += o
    contents = @contents
    define_method(:contents) { contents }
  end
end

class Bar < Foo
  contains :goat, :boat
  contains :stoat
end

p Bar.new.contents # => [:goat, :boat, :stoat]

Thanks!

-- 
William <wmorgan-ruby-talk / masanjin.net>