Skip to content

Instantly share code, notes, and snippets.

@stpettersens
Created July 19, 2011 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stpettersens/1092031 to your computer and use it in GitHub Desktop.
Save stpettersens/1092031 to your computer and use it in GitHub Desktop.
Method Missing Demo
module MyModule
# Public methods.....
def self.doSomething(parameter)
...
end
def self.doSomethingElse()
...
end
def method_missing(method)
puts "Method: \"#{method}\" does not exist."
end
# EOF
I want the following, as demonstrated in IRB:
> require "mymodule"
=> true
> MyModule.doSomething()
=> (output)
> MyModule.doesNotExist()
=> Method: "doesNotExist" does not exist.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment