Class: Lucid::Parser::SpecBuilder::BackgroundBuilder

Inherits:
Spec
  • Object
show all
Defined in:
lib/lucid/spec_builder.rb

Instance Method Summary collapse

Methods inherited from Spec

#initialize

Constructor Details

This class inherits a constructor from Lucid::Parser::SpecBuilder::Spec

Instance Method Details

#add_child(child) ⇒ Object



188
189
190
# File 'lib/lucid/spec_builder.rb', line 188

def add_child(child)
  children << child
end

#childrenObject



192
193
194
# File 'lib/lucid/spec_builder.rb', line 192

def children
  @children ||= []
end

#result(language) ⇒ Object



170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/lucid/spec_builder.rb', line 170

def result(language)
  background = Lucid::AST::Background.new(
    language,
    location,
    comment,
    node.keyword,
    node.name,
    node.description,
    steps(language)
  )
  background.gherkin_statement(node)
  background
end

#steps(language) ⇒ Object



184
185
186
# File 'lib/lucid/spec_builder.rb', line 184

def steps(language)
  children.map { |child| child.result(language) }
end