Skip to content

Instantly share code, notes, and snippets.

@lachie
Created October 6, 2009 23:08
Show Gist options
  • Save lachie/203539 to your computer and use it in GitHub Desktop.
Save lachie/203539 to your computer and use it in GitHub Desktop.
require 'pp'
class Object
def tap
yield self
self
end
def tapp
pp self
self
end
end
a = [nil, :apple, [:others]].flatten.tapp.compact.tapp
#> [nil, :apple, :others]
#> [:apple, :others]
a.tapp
#> [:apple, :others]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment