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.
# File lib/cucumber/parser/gherkin_builder.rb, line 10 def ast @feature || @multiline_arg end
# 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
# File lib/cucumber/parser/gherkin_builder.rb, line 109 def eof grab_table! end
# 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
# 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
# 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
# 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
# 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
# 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
# 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
Generated with the Darkfish Rdoc Generator 2.