I am mostly re-posting my question from SO, because i think it can get
lost there, and i hope that on this specialized forum i would get some
So, i do not understand how and when to use Ruby’s
method instead of
SimpleDelegator class. All of the following seem to
work mostly identically:
a = SimpleDelegator.new() b = DelegateClass(Array).new() c = DelegateClass(String).new() a << 1 b << 2 c << 3 p a # => [0, 1] p b # => [0, 2] p c # => [0, 3]
It does not seem to matter which class is passed to DelegateClass.