Parent

Class/Module Index [+]

Quicksearch

Cucumber::Parser::GherkinBuilder

This class conforms to the Gherkin event API and builds the “legacy” AST. It will be replaced later when we have a new “clean” AST.

Public Instance Methods

ast() click to toggle source
# File lib/cucumber/parser/gherkin_builder.rb, line 10
def ast
  @feature || @multiline_arg
end
background(keyword, name, line) click to toggle source
# File lib/cucumber/parser/gherkin_builder.rb, line 35
def background(keyword, name, line)
  @background = Ast::Background.new(
    Ast::Comment.new(grab_comments!('')), 
    line, 
    keyword, 
    name, 
    steps=[]
  )
  @feature.background = @background
  @background.feature = @feature
  @step_container = @background
end
comment(content, line) click to toggle source
# File lib/cucumber/parser/gherkin_builder.rb, line 19
def comment(content, line)
  @comments ||= []
  @comments << content
end
eof() click to toggle source
# File lib/cucumber/parser/gherkin_builder.rb, line 109
def eof
  grab_table!
end
examples(keyword, name, line) click to toggle source
# File lib/cucumber/parser/gherkin_builder.rb, line 84
def examples(keyword, name, line)
  grab_table!
  @examples_fields = [Ast::Comment.new(grab_comments!('')), line, keyword, name]
end
feature(keyword, name, line) click to toggle source
# File lib/cucumber/parser/gherkin_builder.rb, line 24
def feature(keyword, name, line)
  @feature = Ast::Feature.new(
    nil, 
    Ast::Comment.new(grab_comments!('')), 
    Ast::Tags.new(nil, grab_tags!('')),
    keyword,
    name,
    []
  )
end
py_string(string, line) click to toggle source
# File lib/cucumber/parser/gherkin_builder.rb, line 104
def py_string(string, line)
  @multiline_arg = Ast::PyString.new(string)
  @table_owner.multiline_arg = @multiline_arg if @table_owner
end
row(row, line) click to toggle source
# File lib/cucumber/parser/gherkin_builder.rb, line 95
def row(row, line)
  @rows ||= []
  @rows << row
  class << row
    attr_accessor :line
  end
  row.line = line
end
scenario(keyword, name, line) click to toggle source
# File lib/cucumber/parser/gherkin_builder.rb, line 48
def scenario(keyword, name, line)
  grab_table!
  scenario = Ast::Scenario.new(
    @background, 
    Ast::Comment.new(grab_comments!('')), 
    Ast::Tags.new(nil, grab_tags!('')), 
    line, 
    keyword, 
    name, 
    steps=[]
  )
  @feature.add_feature_element(scenario)
  @background.feature_elements << scenario if @background
  @step_container = scenario
end
scenario_outline(keyword, name, line) click to toggle source
# File lib/cucumber/parser/gherkin_builder.rb, line 64
def scenario_outline(keyword, name, line)
  grab_table!
  scenario_outline = Ast::ScenarioOutline.new(
    @background, 
    Ast::Comment.new(grab_comments!('')), 
    Ast::Tags.new(nil, grab_tags!('')), 
    line, 
    keyword, 
    name, 
    steps=[],
    example_sections=[]
  )
  @feature.add_feature_element(scenario_outline)
  if @background
    @background = @background.dup
    @background.feature_elements << scenario_outline
  end
  @step_container = scenario_outline
end
step(keyword, name, line) click to toggle source
# File lib/cucumber/parser/gherkin_builder.rb, line 89
def step(keyword, name, line)
  grab_table!
  @table_owner = Ast::Step.new(line, keyword, name)
  @step_container.add_step(@table_owner)
end
syntax_error(state, event, legal_events, line) click to toggle source
# File lib/cucumber/parser/gherkin_builder.rb, line 113
def syntax_error(state, event, legal_events, line)
  # raise "SYNTAX ERROR"
end
tag(name, line) click to toggle source
# File lib/cucumber/parser/gherkin_builder.rb, line 14
def tag(name, line)
  @tags ||= []
  @tags << name
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.