Module: PipedRuby

Defined in:
lib/piped_ruby.rb,
lib/piped_ruby/version.rb

Constant Summary collapse

VERSION =
'0.2.1'

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pipedObject

Returns the value of attribute piped.



4
5
6
# File 'lib/piped_ruby.rb', line 4

def piped
  @piped
end

#to_pipeObject

Returns the value of attribute to_pipe.



4
5
6
# File 'lib/piped_ruby.rb', line 4

def to_pipe
  @to_pipe
end

Instance Method Details

#>>(&chained) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/piped_ruby.rb', line 6

def >>(&chained)
  self.to_pipe = call if to_pipe.nil?

  chained.piped   = to_pipe
  chained.to_pipe = chained.call(to_pipe)

  chained
end

#unwrapObject



15
16
17
18
19
# File 'lib/piped_ruby.rb', line 15

def unwrap
  to_pipe || call(piped)
rescue ArgumentError
  call
end