Guest User

Untitled

a guest
Feb 21st, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. require 'prohax'
  2.  
  3. def add a
  4. let( :to => proc { |b| b + a })
  5. end
  6.  
  7. add(5).to(3)
  8. # => 8
  9.  
  10. def _if s
  11. let( :then => proc { |blk| blk.call if s })
  12. end
  13.  
  14. _if(true).then proc { 5 }
  15. # => 5
  16. _if(false).then proc { 5 }
  17. # => nil
  18.  
  19. # I have no idea why you would do it that way.
Add Comment
Please, Sign In to add comment