Class: Gherkin::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/gherkin/query.rb

Instance Method Summary collapse

Constructor Details

#initializeQuery

Returns a new instance of Query.



5
6
7
8
9
# File 'lib/gherkin/query.rb', line 5

def initialize
  @ast_node_locations = {}
  @scenario_parent_locations = {}
  @background_locations = {}
end

Instance Method Details

#location(ast_node_id) ⇒ Object



21
22
23
24
25
# File 'lib/gherkin/query.rb', line 21

def location(ast_node_id)
  return @ast_node_locations[ast_node_id] if @ast_node_locations.has_key?(ast_node_id)

  raise AstNodeNotLocatedException, "No location found for #{ast_node_id} }. Known: #{@ast_node_locations.keys}"
end

#scenario_parent_locations(scenario_node_id) ⇒ Object



15
16
17
18
19
# File 'lib/gherkin/query.rb', line 15

def scenario_parent_locations(scenario_node_id)
  return @scenario_parent_locations[scenario_node_id] if @scenario_parent_locations.has_key?(scenario_node_id)

  raise AstNodeNotLocatedException, "No scenario parent locations found for #{scenario_node_id} }. Known: #{@scenario_parent_locations.keys}"
end

#update(message) ⇒ Object



11
12
13
# File 'lib/gherkin/query.rb', line 11

def update(message)
  update_feature(message.gherkin_document.feature) if message.gherkin_document
end