Sha256: 46fee555185f94cc33bf1e82f65299b04a0634e216f3cfcc29d0599a1e9b0904

Contents?: true

Size: 580 Bytes

Versions: 66

Compression:

Stored size: 580 Bytes

Contents

module Gherkin
  class AstNode
    attr_reader :rule_type

    def initialize(rule_type)
      @rule_type = rule_type
      @_sub_items = Hash.new { |hash, key| hash[key] = [] } # returns [] for unknown key
    end

    def add(rule_type, obj)
      @_sub_items[rule_type].push(obj)
    end

    def get_single(rule_type)
      @_sub_items[rule_type].first
    end

    def get_items(rule_type)
      @_sub_items[rule_type]
    end

    def get_token(token_type)
      get_single(token_type)
    end

    def get_tokens(token_type)
      @_sub_items[token_type]
    end
  end
end

Version data entries

66 entries across 66 versions & 5 rubygems

Version Path
cucumber-gherkin-30.0.0 lib/gherkin/ast_node.rb
cucumber-gherkin-29.0.0 lib/gherkin/ast_node.rb
cucumber-gherkin-28.0.0 lib/gherkin/ast_node.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/cucumber-gherkin-26.2.0/lib/gherkin/ast_node.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/cucumber-gherkin-26.2.0/lib/gherkin/ast_node.rb
cucumber-gherkin-27.0.0 lib/gherkin/ast_node.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-gherkin-23.0.1/lib/gherkin/ast_node.rb
cucumber-gherkin-26.2.0 lib/gherkin/ast_node.rb
cucumber-gherkin-26.1.0 lib/gherkin/ast_node.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-gherkin-23.0.1/lib/gherkin/ast_node.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-gherkin-23.0.1/lib/gherkin/ast_node.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-gherkin-23.0.1/lib/gherkin/ast_node.rb
cucumber-gherkin-26.0.3 lib/gherkin/ast_node.rb
cucumber-gherkin-26.0.2 lib/gherkin/ast_node.rb
cucumber-gherkin-26.0.1 lib/gherkin/ast_node.rb
cucumber-gherkin-26.0.0 lib/gherkin/ast_node.rb
cucumber-gherkin-25.0.2 lib/gherkin/ast_node.rb
cucumber-gherkin-25.0.1 lib/gherkin/ast_node.rb
cucumber-gherkin-25.0.0 lib/gherkin/ast_node.rb
cucumber-gherkin-24.1.0 lib/gherkin/ast_node.rb