Skip to content

Instantly share code, notes, and snippets.

@halferty
Last active August 29, 2015 14:10
Show Gist options
  • Select an option

  • Save halferty/ff6416e0f822dc059e0f to your computer and use it in GitHub Desktop.

Select an option

Save halferty/ff6416e0f822dc059e0f to your computer and use it in GitHub Desktop.
more monads
class Object; def if(&block); (yield(self))? self : nil; end; end;
class String; def unless_empty; self.if { |a| a.size > 0 }; end; end;
@halferty
Copy link
Author

halferty commented Dec 1, 2014

"".unless_empty.andand.length

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment