Welcome!  login or register

Your great ideas will be born here
language: Ruby (ruby 1.8.7)
date: 273 days 4 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
 
a = {'cat'=>'dog'}
b = {'monkey'=>'horse'}
 
def a.method_missing(n)
   self[n.to_s]
end
 
puts a.cat
 
puts b.monkey
  • upload with new input

  • result: Success     time: 0s    memory: 4868 kB     returned value: 1       Would you like to manage your submissions?
    Sign up now and enjoy the full functionality of Ideone.

    dog
    
    prog:11:in `<main>': undefined method `monkey' for {"monkey"=>"horse"}:Hash (NoMethodError)