Guest User

Untitled

a guest
Jun 13th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. def a(options)
  2. options[:null] || false
  3. end
  4.  
  5. def b(options)
  6. options[:null] if options.has_key?(:null)
  7. end
  8.  
  9.  
  10. options = {:null => true}
  11. p a(options) #=> false
  12. p b(options) #=> nil
  13. puts
  14.  
  15.  
  16. options = {:null => false}
  17. p a(options) #=> false
  18. p b(options) #=> false
  19. puts
  20.  
  21.  
  22. options = {:null => nil}
  23. p a(options) #=> false
  24. p b(options) #=> nil
  25. puts
  26.  
  27.  
  28. options = {}
  29. p a(options) #=> false
  30. p b(options) #=> nil
  31. puts
Add Comment
Please, Sign In to add comment