timriley (owner)

Fork Of

Revisions

gist: 207644 Download_button fork
public
Public Clone URL: git://gist.github.com/207644.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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]