Skip to content

Instantly share code, notes, and snippets.

@Ejhfast
Created December 29, 2010 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ejhfast/758649 to your computer and use it in GitHub Desktop.
Save Ejhfast/758649 to your computer and use it in GitHub Desktop.
# New object
e = FStore.new
# Define a bunch of methods dynamically
e.double {|x| 2*x}
e.triple {|x| 3*x}
e.square {|x| x**2}
e.plus {|x,y| x + y}
# Then you can use them, like so:
e.double 2 #=> 4
e.triple 2 #=> 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment