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)



39
40
41
# File 'lib/gherkin/formatter/tag_count_formatter.rb', line 39

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

Instance Method Details

#examples(statement, examples_rows) ⇒ Object



25
26
27
28
# File 'lib/gherkin/formatter/tag_count_formatter.rb', line 25

def examples(statement, examples_rows)
  record_tags((@feature_tags.to_a + @scenario_outline_tags.to_a + statement.tags.to_a).uniq, statement.line)
  @formatter.examples(statement, examples_rows)
end

#feature(statement, uri) ⇒ Object



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

def feature(statement, uri)
  @feature_tags = statement.tags
  @uri = uri
  @formatter.feature(statement, uri)
end

#scenario(statement) ⇒ Object



15
16
17
18
# File 'lib/gherkin/formatter/tag_count_formatter.rb', line 15

def scenario(statement)
  record_tags((@feature_tags.to_a + statement.tags.to_a).uniq, statement.line)
  @formatter.scenario(statement)
end

#scenario_outline(statement) ⇒ Object



20
21
22
23
# File 'lib/gherkin/formatter/tag_count_formatter.rb', line 20

def scenario_outline(statement)
  @scenario_outline_tags = statement.tags
  @formatter.scenario_outline(statement)
end