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

Constructor Details

#initializeFeatureBuilder

Returns a new instance of FeatureBuilder.



111
112
113
114
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 111

def initialize(*)
  super
  @background_builder = nil
end

Instance Attribute Details

#background_builder=(value) ⇒ Object

Sets the attribute background_builder

Parameters:

  • value

    the value to set the attribute background_builder to.



108
109
110
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 108

def background_builder=(value)
  @background_builder = value
end

Instance Method Details

#add_child(child) ⇒ Object



133
134
135
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 133

def add_child(child)
  children << child
end

#childrenObject



137
138
139
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 137

def children
  @children ||= []
end

#result(language) ⇒ Object



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 116

def result(language)
  background = background(language)
  feature = Ast::Feature.new(
    location,
    background,
    comments,
    tags,
    node.keyword,
    node.name.lstrip,
    node.description.rstrip,
    children.map { |builder| builder.result(background, language, tags) }
  )
  feature.gherkin_statement(node)
  feature.language = language
  feature
end