Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lass Hash
- def method_missing name, *args, &blk
- if name[-1] == "="
- define_singleton_method name do |arg|
- self[name[0...-1].to_sym] = arg
- end
- send(name, *args)
- else if has_key? name.to_sym
- define_singleton_method name do
- self[name.to_sym]
- end
- send(name, *args)
- raise NoMethodError
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement