Class: Cucumber::Formatter::TagCloud
Overview
Custom formatter that prints a tag cloud
Instance Attribute Summary
Attributes inherited from Ast::Visitor
#options, #step_mother
Instance Method Summary
collapse
#announce, #matches_scenario_names?, #visit_background, #visit_background_name, #visit_comment, #visit_comment_line, #visit_examples, #visit_examples_array, #visit_examples_name, #visit_exception, #visit_feature, #visit_feature_element, #visit_feature_name, #visit_multiline_arg, #visit_outline_table, #visit_py_string, #visit_scenario_name, #visit_step, #visit_step_name, #visit_step_result, #visit_steps, #visit_table_cell, #visit_table_cell_value, #visit_table_row, #visit_tags
Constructor Details
#initialize(step_mother, io, options) ⇒ TagCloud
5
6
7
8
9
10
|
# File 'lib/cucumber/formatter/tag_cloud.rb', line 5
def initialize(step_mother, io, options)
super(step_mother)
@io = io
@options = options
@counts = Hash.new{|h,k| h[k] = 0}
end
|
Instance Method Details
#print_summary(features) ⇒ Object
21
22
23
24
25
|
# File 'lib/cucumber/formatter/tag_cloud.rb', line 21
def print_summary(features)
matrix = @counts.to_a.sort{|paira, pairb| paira[0] <=> pairb[0]}.transpose
table = Cucumber::Ast::Table.new(matrix)
Cucumber::Formatter::Pretty.new(@step_mother, @io, {}).visit_multiline_arg(table)
end
|
#visit_features(features) ⇒ Object
12
13
14
15
|
# File 'lib/cucumber/formatter/tag_cloud.rb', line 12
def visit_features(features)
super
print_summary(features)
end
|
#visit_tag_name(tag_name) ⇒ Object
17
18
19
|
# File 'lib/cucumber/formatter/tag_cloud.rb', line 17
def visit_tag_name(tag_name)
@counts[tag_name] += 1
end
|