1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
attribute_reader(name) attribute_writer(name) end define_method(name) do instance_variable_get "@" end end define_method "=" do |value| instance_variable_set "@", value end end end Class.instance_eval do include MetaSkills end attribute_accessor :foo end o = MyClass.new o.foo # => nil o.foo = 'bar' # => "bar" o # => #<MyClass:0x1001722c0 @foo="bar"> |

