Skip to content

Instantly share code, notes, and snippets.

@senny
Last active August 29, 2015 14:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save senny/9864a138defa322ed807 to your computer and use it in GitHub Desktop.
Save senny/9864a138defa322ed807 to your computer and use it in GitHub Desktop.
Ruby 2.2.1 bug
$ ruby --version
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
class Person
def implicit
nope rescue nil
public_send "nope"
end
def implicit_assignment
nope rescue nil
public_send "nope="
end
def method_missing(*args)
super
end
end
a = Person.new
a.implicit
# test.rb:13:in `method_missing': undefined method `nope' for #<Person:0x007fbad285f4c8> (NoMethodError)
# from test.rb:9:in `public_send'
# from test.rb:9:in `implicit'
# from test.rb:18:in `<main>'
a.implicit_assignment
# test.rb:13:in `method_missing': undefined local variable or method `nope=' for #<Person:0x007f91d1052ef8> (NameError)
# from test.rb:4:in `public_send'
# from test.rb:4:in `implicit_assignment'
# from test.rb:24:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment