William Morgan wrote:
> Hi all,
>
> Quick question: is there a better way to write Foo.contains below?
> Forcing the lexical scoping like this feels wrong.

Maybe:

 class Foo
   def contents
     self.class.contains
   end
   def self.contains *o
     @contents ||= []
     return @contents if o.empty?
     @contents += o
   end
 end

> class Bar < Foo
>   contains :goat, :boat
>   contains :stoat
> end
> 
> p Bar.new.contents # => [:goat, :boat, :stoat]

T.