Class: Cucumber::Formatter::TagCloud
- Inherits:
-
Ast::Visitor
- Object
- Ast::Visitor
- Cucumber::Formatter::TagCloud
- Defined in:
- lib/cucumber/formatter/tag_cloud.rb
Overview
The formatter used for --format tag_cloud
Custom formatter that prints a tag cloud as a table.
Instance Attribute Summary
Attributes inherited from Ast::Visitor
Instance Method Summary collapse
-
#initialize(step_mother, io, options) ⇒ TagCloud
constructor
A new instance of TagCloud.
- #print_summary(features) ⇒ Object
- #visit_features(features) ⇒ Object
- #visit_tag_name(tag_name) ⇒ Object
Methods inherited from Ast::Visitor
#announce, #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
Returns a new instance of TagCloud.
6 7 8 9 10 11 |
# File 'lib/cucumber/formatter/tag_cloud.rb', line 6 def initialize(step_mother, io, ) super(step_mother) @io = io @options = @counts = Hash.new{|h,k| h[k] = 0} end |
Instance Method Details
#print_summary(features) ⇒ Object
22 23 24 25 26 |
# File 'lib/cucumber/formatter/tag_cloud.rb', line 22 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
13 14 15 16 |
# File 'lib/cucumber/formatter/tag_cloud.rb', line 13 def visit_features(features) super print_summary(features) end |
#visit_tag_name(tag_name) ⇒ Object
18 19 20 |
# File 'lib/cucumber/formatter/tag_cloud.rb', line 18 def visit_tag_name(tag_name) @counts[tag_name] += 1 end |