Skip to content

Instantly share code, notes, and snippets.

@timriley
Forked from lachie/gist:203539
Created October 11, 2009 11:57
Show Gist options
  • Save timriley/207644 to your computer and use it in GitHub Desktop.
Save timriley/207644 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