Class: Pacer::Core::Route::DetachedRoute

Inherits:
Object
  • Object
show all
Defined in:
lib/pacer/core/route.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(route) ⇒ DetachedRoute

Returns a new instance of DetachedRoute.



643
644
645
646
647
648
649
# File 'lib/pacer/core/route.rb', line 643

def initialize(route)
  @route = route
  w = route.send(:configure_iterator)
  if w.respond_to? :instance
    @preconfig = w
  end
end

Instance Attribute Details

#preconfigObject (readonly)

Returns the value of attribute preconfig.



641
642
643
# File 'lib/pacer/core/route.rb', line 641

def preconfig
  @preconfig
end

#routeObject (readonly)

Returns the value of attribute route.



641
642
643
# File 'lib/pacer/core/route.rb', line 641

def route
  @route
end

Instance Method Details

#build(graph, gather = true) ⇒ Object



651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
# File 'lib/pacer/core/route.rb', line 651

def build(graph, gather = true)
  if route.is_a? Pacer::Filter::EmptyFilter
    pipe = Pacer::Pipes::IdentityPipe.new
  else
    pipe = Pacer::Route.pipeline route
  end
  expando = Pacer::Pipes::ExpandablePipe.new
  expando.enablePath true
  pipe.setStarts expando
  if preconfig
    pipe = preconfig.instance pipe, graph
  else
    pipe = route.send(:configure_iterator, pipe, graph)
  end
  pipe = yield pipe if block_given?
  if gather
    g = Pacer::Pipes::GatherPipe.new
    g.setStarts pipe
    DetachedPipe.new(expando, g, true)
  else
    DetachedPipe.new(expando, pipe, false)
  end
end