class Gherkin::AstNode
Attributes
rule_type[R]
Public Class Methods
new(rule_type)
click to toggle source
# File lib/gherkin/ast_node.rb, line 5 def initialize(rule_type) @rule_type = rule_type @_sub_items = Hash.new { |hash, key| hash[key] = [] } # returns [] for unknown key end
Public Instance Methods
add(rule_type, obj)
click to toggle source
# File lib/gherkin/ast_node.rb, line 10 def add(rule_type, obj) @_sub_items[rule_type].push(obj) end
get_items(rule_type)
click to toggle source
# File lib/gherkin/ast_node.rb, line 18 def get_items(rule_type) @_sub_items[rule_type] end
get_single(rule_type)
click to toggle source
# File lib/gherkin/ast_node.rb, line 14 def get_single(rule_type) @_sub_items[rule_type].first end
get_token(token_type)
click to toggle source
# File lib/gherkin/ast_node.rb, line 22 def get_token(token_type) get_single(token_type) end
get_tokens(token_type)
click to toggle source
# File lib/gherkin/ast_node.rb, line 26 def get_tokens(token_type) @_sub_items[token_type] end