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.



3
4
5
6
7
# File 'lib/gherkin/query.rb', line 3

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

Instance Method Details

#location(ast_node_id) ⇒ Object



19
20
21
22
23
# File 'lib/gherkin/query.rb', line 19

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



13
14
15
16
17
# File 'lib/gherkin/query.rb', line 13

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



9
10
11
# File 'lib/gherkin/query.rb', line 9

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