Class: Cucumber::Core::Gherkin::AstBuilder::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/core/gherkin/ast_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(file, attributes) ⇒ Builder

Returns a new instance of Builder.



30
31
32
33
34
35
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 30

def initialize(file, attributes)
  @file = file
  @attributes = rubify_keys(attributes.dup)
  @comments = []
  @line = @attributes[:location][:line]
end

Instance Method Details

#handle_comments(comments) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/cucumber/core/gherkin/ast_builder.rb', line 37

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