class Gherkin::Formatter::TagCountFormatter

Public Class Methods

new(formatter, tag_counts) click to toggle source
# File lib/gherkin/formatter/tag_count_formatter.rb, line 4
def initialize(formatter, tag_counts)
  @formatter = formatter
  @tag_counts = tag_counts
end

Public Instance Methods

examples(examples) click to toggle source
# File lib/gherkin/formatter/tag_count_formatter.rb, line 28
def examples(examples)
  record_tags((@feature_tags.to_a + @scenario_outline_tags.to_a + examples.tags.to_a).uniq, examples.line)
  @formatter.examples(examples)
end
feature(feature) click to toggle source
# File lib/gherkin/formatter/tag_count_formatter.rb, line 13
def feature(feature)
  @feature_tags = feature.tags
  @formatter.feature(feature)
end
scenario(scenario) click to toggle source
# File lib/gherkin/formatter/tag_count_formatter.rb, line 18
def scenario(scenario)
  record_tags((@feature_tags.to_a + scenario.tags.to_a).uniq, scenario.line)
  @formatter.scenario(scenario)
end
scenario_outline(scenario_outline) click to toggle source
# File lib/gherkin/formatter/tag_count_formatter.rb, line 23
def scenario_outline(scenario_outline)
  @scenario_outline_tags = scenario_outline.tags
  @formatter.scenario_outline(scenario_outline)
end
uri(uri) click to toggle source
# File lib/gherkin/formatter/tag_count_formatter.rb, line 9
def uri(uri)
  @uri = uri
end

Private Instance Methods

method_missing(*args) click to toggle source
# File lib/gherkin/formatter/tag_count_formatter.rb, line 42
def method_missing(*args)
  @formatter.__send__(*args)
end
record_tags(tags, line) click to toggle source
# File lib/gherkin/formatter/tag_count_formatter.rb, line 35
def record_tags(tags, line)
  tags.each do |tag|
    @tag_counts[tag.name] ||= []
    @tag_counts[tag.name] << "#{@uri}:#{line}"
  end
end