Class: Cucumber::Core::Gherkin::AstBuilder::Builder
- Inherits:
-
Object
- Object
- Cucumber::Core::Gherkin::AstBuilder::Builder
- Defined in:
- lib/cucumber/core/gherkin/ast_builder.rb
Direct Known Subclasses
BackgroundBuilder, DataTableBuilder, DocStringBuilder, ExamplesTableBuilder, ExamplesTableBuilder::ExampleRowBuilder, ExamplesTableBuilder::HeaderBuilder, FeatureBuilder, ScenarioBuilder, ScenarioOutlineBuilder, StepBuilder
Instance Method Summary collapse
- #handle_comments(comments) ⇒ Object
-
#initialize(file, attributes) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(file, attributes) ⇒ Builder
Returns a new instance of Builder.
29 30 31 32 33 34 |
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 29 def initialize(file, attributes) @file = file @attributes = rubify_keys(attributes.dup) @comments = [] @line = @attributes[:location][:line] end |
Instance Method Details
#handle_comments(comments) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 36 def handle_comments(comments) remaining_comments = [] comments.each do |comment| if line > comment.location.line @comments << comment else remaining_comments << comment end end children.each { |child| remaining_comments = child.handle_comments(remaining_comments) } remaining_comments end |