class Cucumber::Formatter::AstLookup::TestStepLookupBuilder

Attributes

lookup_hash[R]

Public Class Methods

new(gherkin_document) click to toggle source
# File lib/cucumber/formatter/ast_lookup.rb, line 103
def initialize(gherkin_document)
  @lookup_hash = {}
  process_scenario_container(gherkin_document.feature)
end

Private Instance Methods

process_scenario_container(container) click to toggle source
# File lib/cucumber/formatter/ast_lookup.rb, line 110
def process_scenario_container(container)
  container.children.each do |child|
    if child.respond_to?(:rule) && child.rule
      process_scenario_container(child.rule)
    elsif child.respond_to?(:scenario) && child.scenario
      child.scenario.steps.each do |step|
        @lookup_hash[step.location.line] = StepSource.new(:Step, step)
      end
    elsif !child.background.nil?
      child.background.steps.each do |step|
        @lookup_hash[step.location.line] = StepSource.new(:Step, step)
      end
    end
  end
end