Class: RedGrape::Pipe::CopySplitPipe

Inherits:
Base show all
Defined in:
lib/red_grape/pipe/copy_split_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, #last?, #method_missing, #pass_next, #pipe_eval, #pipe_name, #size, #take, #to_a, #to_ary, #to_s

Constructor Details

#initialize(prev, *opts, &block) ⇒ CopySplitPipe

Returns a new instance of CopySplitPipe.



6
7
8
9
# File 'lib/red_grape/pipe/copy_split_pipe.rb', line 6

def initialize(prev, *opts, &block)
  super
  @opts2 = @opts.dup # TODO: bug!
end

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



11
12
13
14
15
16
17
18
19
# File 'lib/red_grape/pipe/copy_split_pipe.rb', line 11

def pass(obj, context)
  #pipelines = self.opts.map do |pipeline|
  pipelines = @opts2.map do |pipeline| # TODO: opts2??
    pipe = pipeline.first_pipe
    pipe.prev = obj
    pipe
  end
  pass_next context, Pipelines.new(pipelines)
end