Sha256: 4156b312522c4c6eb3b7aa1798e95d018320c92d20c2bf6689a30bdad51454cd

Contents?: true

Size: 919 Bytes

Versions: 68

Compression:

Stored size: 919 Bytes

Contents

require 'cucumber/cucumber_expressions/group'

module Cucumber
  module CucumberExpressions
    class GroupBuilder
      attr_accessor :source

      def initialize
        @group_builders = []
        @capturing = true
      end

      def add(group_builder)
        @group_builders.push(group_builder)
      end

      def build(match, group_indices)
        group_index = group_indices.next
        children = @group_builders.map {|gb| gb.build(match, group_indices)}
        Group.new(match[group_index], match.offset(group_index)[0], match.offset(group_index)[1], children)
      end

      def set_non_capturing!
        @capturing = false
      end

      def capturing?
        @capturing
      end

      def move_children_to(group_builder)
        @group_builders.each do |child|
          group_builder.add(child)
        end
      end

      def children
        @group_builders
      end
    end
  end
end

Version data entries

68 entries across 68 versions & 5 rubygems

Version Path
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/cucumber-cucumber-expressions-16.1.2/lib/cucumber/cucumber_expressions/group_builder.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/group_builder.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/group_builder.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/group_builder.rb
cucumber-cucumber-expressions-16.1.2 lib/cucumber/cucumber_expressions/group_builder.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/group_builder.rb
cucumber-cucumber-expressions-16.1.1 lib/cucumber/cucumber_expressions/group_builder.rb
cucumber-cucumber-expressions-16.1.0 lib/cucumber/cucumber_expressions/group_builder.rb
cucumber-cucumber-expressions-16.0.1 lib/cucumber/cucumber_expressions/group_builder.rb
cucumber-cucumber-expressions-16.0.0 lib/cucumber/cucumber_expressions/group_builder.rb
cucumber-cucumber-expressions-15.2.0 lib/cucumber/cucumber_expressions/group_builder.rb
cucumber-cucumber-expressions-15.1.1 lib/cucumber/cucumber_expressions/group_builder.rb
cucumber-cucumber-expressions-15.1.0 lib/cucumber/cucumber_expressions/group_builder.rb
cucumber-cucumber-expressions-15.0.2 lib/cucumber/cucumber_expressions/group_builder.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/cucumber-cucumber-expressions-14.0.0/lib/cucumber/cucumber_expressions/group_builder.rb
cucumber-cucumber-expressions-15.0.1 lib/cucumber/cucumber_expressions/group_builder.rb
cucumber-cucumber-expressions-14.0.0 lib/cucumber/cucumber_expressions/group_builder.rb
cucumber-cucumber-expressions-13.1.3 lib/cucumber/cucumber_expressions/group_builder.rb
cucumber-cucumber-expressions-13.1.2 lib/cucumber/cucumber_expressions/group_builder.rb
cucumber-cucumber-expressions-13.1.1 lib/cucumber/cucumber_expressions/group_builder.rb