Skip to content

Instantly share code, notes, and snippets.

@rezonant
Created November 3, 2010 23:41
Show Gist options
  • Select an option

  • Save rezonant/661904 to your computer and use it in GitHub Desktop.

Select an option

Save rezonant/661904 to your computer and use it in GitHub Desktop.
Making a clean, modular, disposable binding for a shell
module SomeCommands; def add(x, y) x + y end; end; import SomeCommands;
add 1, 1 # => 2
String.add 1, 1 # => 2 # ... with some solutions
"hello".add 1, 1 # => # ... with others
"hello".add 1, 1 # NoMethodError # is what I want
"hello".instance_eval "add(1, 1)" # NoMethodError # as well
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment