Module: Cucumber::Core::Gherkin::Writer::AcceptsComments

Included in:
HasElements
Defined in:
lib/cucumber/core/gherkin/writer/helpers.rb

Instance Method Summary collapse

Instance Method Details

#comment(line) ⇒ Object



56
57
58
# File 'lib/cucumber/core/gherkin/writer/helpers.rb', line 56

def comment(line)
  comment_lines << "# #{line}"
end

#comment_linesObject



60
61
62
# File 'lib/cucumber/core/gherkin/writer/helpers.rb', line 60

def comment_lines
  @comment_lines ||= []
end

#slurp_commentsObject



64
65
66
67
68
69
70
71
# File 'lib/cucumber/core/gherkin/writer/helpers.rb', line 64

def slurp_comments
  # TODO: I can't think of another way to handle this?
  # When we use the comments, we need to reset the collection
  # for the next element...
  slurped_comments = comment_lines.dup
  @comment_lines = nil
  slurped_comments
end