class Gherkin::Listener::FormatterListener::Stash

Attributes

comments[R]
ids[R]
tags[R]

Public Class Methods

new() click to toggle source
# File lib/gherkin/listener/formatter_listener.rb, line 94
def initialize
  @comments, @tags, @ids = [], [], []
  @row_index = 0
end

Public Instance Methods

comment(comment) click to toggle source
# File lib/gherkin/listener/formatter_listener.rb, line 99
def comment(comment)
  @comments << comment
end
examples(name) { |comments, tags, examples_id| ... } click to toggle source
# File lib/gherkin/listener/formatter_listener.rb, line 115
def examples(name)
  @examples_id = "#{@feature_element_id};#{id(name)}"
  @row_index = 0
  yield @comments, @tags, @examples_id
  @comments, @tags = [], []
end
feature(name) { |comments, tags, feature_id| ... } click to toggle source
# File lib/gherkin/listener/formatter_listener.rb, line 103
def feature(name)
  @feature_id = id(name)
  yield @comments, @tags, @feature_id
  @comments, @tags = [], []
end
feature_element(name) { |comments, tags, feature_element_id| ... } click to toggle source
# File lib/gherkin/listener/formatter_listener.rb, line 109
def feature_element(name)
  @feature_element_id = "#{@feature_id};#{id(name)}"
  yield @comments, @tags, @feature_element_id
  @comments, @tags = [], []
end
id(name) click to toggle source
# File lib/gherkin/listener/formatter_listener.rb, line 138
def id(name)
  (name || '').gsub(/[\s_]/, '-').downcase
end
row() { |comments, defined?(examples_id) ? "| ... } click to toggle source
# File lib/gherkin/listener/formatter_listener.rb, line 128
def row
  @row_index += 1
  yield @comments, defined?(@examples_id) ? "#{@examples_id};#{@row_index}" : :undefined_examples_id
  @comments = []
end
step() { |comments| ... } click to toggle source
# File lib/gherkin/listener/formatter_listener.rb, line 122
def step
  @row_index += 1
  yield @comments
  @comments = []
end
tag(tag) click to toggle source
# File lib/gherkin/listener/formatter_listener.rb, line 134
def tag(tag)
  @tags << tag
end