Class: Cucumber::Core::Gherkin::AstBuilder::FeatureBuilder

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

#initializeFeatureBuilder

Returns a new instance of FeatureBuilder.



100
101
102
103
104
105
106
107
# 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

Instance Attribute Details

#background_builderObject (readonly)

Returns the value of attribute background_builder.



98
99
100
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 98

def background_builder
  @background_builder
end

#languageObject (readonly)

Returns the value of attribute language.



98
99
100
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 98

def language
  @language
end

#scenario_definition_buildersObject (readonly)

Returns the value of attribute scenario_definition_builders.



98
99
100
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 98

def scenario_definition_builders
  @scenario_definition_builders
end

Instance Method Details

#resultObject



109
110
111
112
113
114
115
116
117
118
119
120
121
122
# 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