Sha256: f0bbb7b7933239ef896af90c8c3c468e690fd75c23b1641969f6171ec5c4bb26

Contents?: true

Size: 1.19 KB

Versions: 14

Compression:

Stored size: 1.19 KB

Contents

module Pacer
  module Routes
    module RouteOperations
      def section(section_name = nil, visitor_target = nil)
        chain_route visitor: :section, section_name: section_name, visitor_target: visitor_target
      end

      # see #as_var for the old as implementation
      def as(section_name = nil)
        section section_name
      end
    end
  end

  module Visitors
    module Section
      attr_accessor :section_name, :visitor_target

      def will_visit!
        @visitor_count = visitor_count + 1
      end

      def section_visitor
        section_visitors.pop
      end

      protected

      def visitor_count
        @visitor_count = 0 unless defined? @visitor_count
        @visitor_count
      end

      attr_reader :section_visitors

      def attach_pipe(end_pipe)
        pipe = end_pipe
        @section_visitors = (1..visitor_count).map do
          pipe = Pacer::Pipes::SimpleVisitorPipe.new Pacer::Wrappers::WrapperSelector.build(graph, element_type, extensions), graph
          pipe.setStarts end_pipe if end_pipe
          end_pipe = pipe
        end
        pipe
      end

      def inspect_class_name
        "#{super}(#{section_name.inspect})"
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
pacer-2.0.10-java lib/pacer/visitors/section.rb
pacer-2.0.10.pre-java lib/pacer/visitors/section.rb
pacer-2.0.8-java lib/pacer/visitors/section.rb
pacer-2.0.6-java lib/pacer/visitors/section.rb
pacer-2.0.4.pre-java lib/pacer/visitors/section.rb
pacer-2.0.0.pre-java lib/pacer/visitors/section.rb
pacer-1.6.0-java lib/pacer/visitors/section.rb
pacer-1.5.4-java lib/pacer/visitors/section.rb
pacer-1.5.3-java lib/pacer/visitors/section.rb
pacer-1.5.2-java lib/pacer/visitors/section.rb
pacer-1.5.1-java lib/pacer/visitors/section.rb
pacer-1.4.2-java lib/pacer/visitors/section.rb
pacer-1.4.1-java lib/pacer/visitors/section.rb
pacer-1.4.0-java lib/pacer/visitors/section.rb