Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 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
Add Comment
Please, Sign In to add comment