Guest User

Untitled

a guest
Jul 18th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. # New object
  2. e = FStore.new
  3.  
  4. # Define a bunch of methods dynamically
  5. e.double {|x| 2*x}
  6. e.triple {|x| 3*x}
  7. e.square {|x| x**2}
  8. e.plus {|x,y| x + y}
  9.  
  10. # Then you can use them, like so:
  11.  
  12. e.double 2 #=> 4
  13. e.triple 2 #=> 6
Add Comment
Please, Sign In to add comment