Class: Gherkin::Formatter::TagCountFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/gherkin/formatter/tag_count_formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(formatter, tag_counts) ⇒ TagCountFormatter

Returns a new instance of TagCountFormatter.



4
5
6
7
# File 'lib/gherkin/formatter/tag_count_formatter.rb', line 4

def initialize(formatter, tag_counts)
  @formatter = formatter
  @tag_counts = tag_counts
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object (private)



42
43
44
# File 'lib/gherkin/formatter/tag_count_formatter.rb', line 42

def method_missing(*args)
  @formatter.__send__(*args)
end

Instance Method Details

#examples(examples) ⇒ Object



28
29
30
31
# 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) ⇒ Object



13
14
15
16
# File 'lib/gherkin/formatter/tag_count_formatter.rb', line 13

def feature(feature)
  @feature_tags = feature.tags
  @formatter.feature(feature)
end

#scenario(scenario) ⇒ Object



18
19
20
21
# 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) ⇒ Object



23
24
25
26
# 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) ⇒ Object



9
10
11
# File 'lib/gherkin/formatter/tag_count_formatter.rb', line 9

def uri(uri)
  @uri = uri
end