I have a class Wrapper
that supports adding options that you can then look up later. It stores these options in an internal hash @dict
.
w = Wrapper.new
w.foo # => NameError
w.foo = 10
w.foo # => 10
How can I write a method_missing
for Wrapper
so that I can support nested calls on @dict
?
w = Wrapper.new
w.foo.bar.baz = 1000
w.foo.bar.baz # => 1000