Guest User

rubirc

a guest
May 25th, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.32 KB | None | 0 0
  1. class SpecialHash < Hash
  2.   def method_missing(method_sym, *arguments, &block)
  3.     if self.include? method_sym
  4.       self[method_sym]
  5.     else
  6.       super
  7.     end
  8.   end
  9.  
  10.   def respond_to?(method_sym, include_private = false)
  11.     if self.include? method_sym
  12.       true
  13.     else
  14.       super
  15.     end
  16.   end
  17. end
Advertisement
Add Comment
Please, Sign In to add comment