Class: RedGrape::Pipe::InPipe

Inherits:
Base show all
Defined in:
lib/red_grape/pipe/in_pipe.rb

Instance Attribute Summary

Attributes inherited from Base

#it, #next, #opts, #prev, #value

Instance Method Summary collapse

Methods inherited from Base

#copy, #done?, #dup, #first?, #first_pipe, #initialize, #last?, #method_missing, #pass_next, #pipe_eval, #size, #take, #to_a, #to_ary, #to_s

Constructor Details

This class inherits a constructor from RedGrape::Pipe::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RedGrape::Pipe::Base

Instance Method Details

#pass(obj, context) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/red_grape/pipe/in_pipe.rb', line 16

def pass(obj, context)
  group =
    if self.opts.empty?
      obj.in_edges.map(&:source)
    else
      label = self.opts.first
      obj.in_edges.find_all{|e| e.label == label}.map(&:source)
    end
  pass_next context, obj, group
end

#pipe_nameObject



12
13
14
# File 'lib/red_grape/pipe/in_pipe.rb', line 12

def pipe_name
  @opts.empty? ? super : "#{super}(#{@opts.first})"
end