class Cucumber::Core::Gherkin::AstBuilder::FeatureBuilder

Attributes

background_builder[R]
language[R]
scenario_definition_builders[R]

Public Class Methods

new(*) click to toggle source
# File lib/cucumber/core/gherkin/ast_builder.rb, line 100
def initialize(*)
  super
  @language = Ast::LanguageDelegator.new(attributes[:language], ::Gherkin::Dialect.for(attributes[:language]))
  @background_builder = BackgroundBuilder.new(file, attributes[:background]) if attributes[:background]
  @scenario_definition_builders = attributes[:scenario_definitions].map do |sd|
    sd[:type] == :Scenario ? ScenarioBuilder.new(file, sd) : ScenarioOutlineBuilder.new(file, sd)
  end
end

Public Instance Methods

result() click to toggle source
# File lib/cucumber/core/gherkin/ast_builder.rb, line 109
def result
  handle_comments(all_comments)
  Ast::Feature.new(
    language,
    location,
    background,
    comments,
    tags,
    keyword,
    name,
    description,
    scenario_definitions
  )
end

Private Instance Methods

all_comments() click to toggle source
# File lib/cucumber/core/gherkin/ast_builder.rb, line 135
def all_comments
  attributes[:comments].map do |comment|
    Ast::Comment.new(
      Ast::Location.new(file, comment[:location][:line]),
      comment[:text]
    )
  end
end
background() click to toggle source
# File lib/cucumber/core/gherkin/ast_builder.rb, line 126
def background
  return Ast::EmptyBackground.new unless background_builder
  background_builder.result(language)
end
children() click to toggle source
# File lib/cucumber/core/gherkin/ast_builder.rb, line 144
def children
  (background_builder ? [background_builder] : []) + scenario_definition_builders
end
scenario_definitions() click to toggle source
# File lib/cucumber/core/gherkin/ast_builder.rb, line 131
def scenario_definitions
  scenario_definition_builders.map { |builder| builder.result(language) }
end