Class: Cucumber::Core::Gherkin::AstBuilder::ScenarioOutlineBuilder

Inherits:
Builder
  • Object
show all
Defined in:
lib/cucumber/core/gherkin/ast_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Builder

#handle_comments

Constructor Details

#initializeScenarioOutlineBuilder

Returns a new instance of ScenarioOutlineBuilder.



258
259
260
261
262
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 258

def initialize(*)
  super
  @step_builders = attributes[:steps].map { |step| OutlineStepBuilder.new(file, step) }
  @example_builders = attributes[:examples].map { |example| ExamplesTableBuilder.new(file, example) }
end

Instance Attribute Details

#example_buildersObject (readonly)

Returns the value of attribute example_builders.



256
257
258
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 256

def example_builders
  @example_builders
end

#step_buildersObject (readonly)

Returns the value of attribute step_builders.



256
257
258
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 256

def step_builders
  @step_builders
end

Instance Method Details

#childrenObject



285
286
287
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 285

def children
  step_builders + example_builders
end

#examples(language) ⇒ Object



281
282
283
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 281

def examples(language)
  example_builders.map { |builder| builder.result(language) }
end

#result(language) ⇒ Object



264
265
266
267
268
269
270
271
272
273
274
275
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 264

def result(language)
  Ast::ScenarioOutline.new(
    location,
    comments,
    tags,
    keyword,
    name,
    description,
    steps(language),
    examples(language)
  )
end

#steps(language) ⇒ Object



277
278
279
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 277

def steps(language)
  step_builders.map { |builder| builder.result(language) }
end