Class: Cucumber::Core::Gherkin::AstBuilder::BackgroundBuilder

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

#initializeBackgroundBuilder

Returns a new instance of BackgroundBuilder.



152
153
154
155
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 152

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

Instance Attribute Details

#step_buildersObject (readonly)

Returns the value of attribute step_builders.



150
151
152
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 150

def step_builders
  @step_builders
end

Instance Method Details

#childrenObject



172
173
174
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 172

def children
  step_builders
end

#result(language) ⇒ Object



157
158
159
160
161
162
163
164
165
166
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 157

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

#steps(language) ⇒ Object



168
169
170
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 168

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