Class: Cucumber::Core::Gherkin::AstBuilder::DocumentBuilder
- Defined in:
- lib/cucumber/core/gherkin/ast_builder.rb
Instance Method Summary collapse
- #all_comments ⇒ Object
- #feature ⇒ Object
-
#initialize(file, attributes) ⇒ DocumentBuilder
constructor
A new instance of DocumentBuilder.
Methods inherited from Builder
Constructor Details
#initialize(file, attributes) ⇒ DocumentBuilder
Returns a new instance of DocumentBuilder.
99 100 101 102 |
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 99 def initialize(file, attributes) @file = file @attributes = rubify_keys(attributes.dup) end |
Instance Method Details
#all_comments ⇒ Object
111 112 113 114 115 116 117 118 |
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 111 def all_comments attributes[:comments].map do |comment| Ast::Comment.new( Ast::Location.new(file, comment[:location][:line]), comment[:text] ) end end |
#feature ⇒ Object
104 105 106 107 108 109 |
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 104 def feature return Ast::NullFeature.new unless attributes[:feature] feature_builder = FeatureBuilder.new(file, attributes[:feature]) feature_builder.handle_comments(all_comments) feature_builder.result end |