Skip to content

Instantly share code, notes, and snippets.

@Sebx
Forked from hackvan/reflexion_V.rb
Created December 13, 2018 02:25
Show Gist options
  • Select an option

  • Save Sebx/b4c10bdc6d9e7e605e7b9fb8f71bb1f5 to your computer and use it in GitHub Desktop.

Select an option

Save Sebx/b4c10bdc6d9e7e605e7b9fb8f71bb1f5 to your computer and use it in GitHub Desktop.
class MethodCatcher
def method_missing(name, *args, &block)
puts "El nombre del método no encontrado es #{name}"
puts "los argumentos del método son #{args}"
puts "El cuerpo del método es #{block.inspect}"
end
end
catch = MethodCatcher.new
catch.some_method(1, 2) { puts "something" }
# El nombre del método no encontrado es some_method
# los argumentos del método son [1, 2]
# El cuerpo del método es #<Proc:0x0033...>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment