Add a method to an existing object

Updated . Posted . Visible to the public.

Use the attached initializer to do stuff like this

str = "abc"
str.imbue(:foo => 'foo value', :bar => 'bar value')
puts str.foo # 'foo value'
puts str.bar # 'bar value'
Profile picture of Henning Koch
Henning Koch
Last edit
Attachments
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2010-08-31 17:38)