J2M wrote: > I would like to be able to be able to include instance methods of a > Struct into a class. e.g. > > foo = Struct.new(:attribute, :another_attribute) > bar = foo.new > > class Bas > > some_ruby_magic > > end > > So that I can then do > > Bas.attribute="a value" > Bas.attribute > Kind of like doing module_functions but that doesn't work inside a > class. Foo = Struct.new(:attribute, :another_attribute) class Bas extend Foo.to_module end Ha! Only if it were so easy! ;-) Actaully if one had access to Ruby's source it would rather trivial (hint). In anycase to par down Ara's solution to it's core: Foo = Struct.new :attribute, :another_attribute class Bas class << self attr_accessor *Foo.members end end Note the use of the constant which eases access by avoiding (class<<self;self;end).class_eval. T.