Skip to content

Instantly share code, notes, and snippets.

@NigoroJr
Created March 21, 2015 22:30
Show Gist options
  • Save NigoroJr/915d11cceb603d58623c to your computer and use it in GitHub Desktop.
Save NigoroJr/915d11cceb603d58623c to your computer and use it in GitHub Desktop.
Ruby script that uses NoMethodError and Object#send to get to an existing method
#!/usr/bin/env ruby
class Class
def foo
puts "FOO!!"
return false
end
end
str = "foa"
c = Class.new
flag = true
while flag
begin
flag = c.send str
rescue
puts "nope"
str.next!
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment