Class: Cucumber::Cli::LanguageHelpFormatter
- Inherits:
-
Formatter::Pretty
- Object
- Ast::Visitor
- Formatter::Pretty
- Cucumber::Cli::LanguageHelpFormatter
- Defined in:
- lib/cucumber/cli/language_help_formatter.rb
Constant Summary collapse
- INCOMPLETE =
%{ The Cucumber grammar has evolved since this translation was written. Please help us complete the translation by translating the missing words in #{Cucumber::LANGUAGE_FILE} Then contribute back to the Cucumber project. Details here: http://wiki.github.com/aslakhellesoy/cucumber/spoken-languages }
Constants included from Formatter::Console
Constants included from Formatter::ANSIColor
Instance Attribute Summary
Attributes inherited from Formatter::Pretty
Attributes inherited from Ast::Visitor
Class Method Summary collapse
Instance Method Summary collapse
- #visit_multiline_arg(table) ⇒ Object
- #visit_table_cell_value(value, status) ⇒ Object
- #visit_table_row(table_row) ⇒ Object
Methods inherited from Formatter::Pretty
#initialize, #visit_background, #visit_background_name, #visit_comment, #visit_comment_line, #visit_examples_name, #visit_exception, #visit_feature, #visit_feature_element, #visit_feature_element_name, #visit_feature_name, #visit_features, #visit_py_string, #visit_scenario_name, #visit_step, #visit_step_name, #visit_step_result, #visit_table_cell, #visit_tag_name, #visit_tags
Methods included from Formatter::Console
#announce, #format_step, #format_string, #print_counts, #print_elements, #print_exception, #print_passing_wip, #print_snippets, #print_stats, #print_steps, #print_tag_limit_warnings, #record_tag_occurrences
Methods included from Formatter::ANSIColor
define_grey, define_real_grey, #grey
Methods included from Formatter::Duration
Methods inherited from Ast::Visitor
#announce, #initialize, #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_features, #visit_outline_table, #visit_py_string, #visit_scenario_name, #visit_step, #visit_step_name, #visit_step_result, #visit_steps, #visit_table_cell, #visit_tag_name, #visit_tags
Constructor Details
This class inherits a constructor from Cucumber::Formatter::Pretty
Class Method Details
.list_keywords(io, lang) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/cucumber/cli/language_help_formatter.rb', line 25 def self.list_keywords(io, lang) language = Parser::I18n::Language[lang] raw = Parser::I18n::Language::KEYWORD_KEYS.map do |key| [key, language.keywords(key)] end table = Ast::Table.new(raw) new(nil, io, {:incomplete => language.incomplete?}).visit_multiline_arg(table) end |
.list_languages(io) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/cucumber/cli/language_help_formatter.rb', line 17 def self.list_languages(io) raw = Cucumber::LANGUAGES.keys.sort.map do |lang| [lang, Cucumber::LANGUAGES[lang]['name'], Cucumber::LANGUAGES[lang]['native']] end table = Ast::Table.new(raw) new(nil, io, {:check_lang=>true}).visit_multiline_arg(table) end |
Instance Method Details
#visit_multiline_arg(table) ⇒ Object
34 35 36 37 38 39 |
# File 'lib/cucumber/cli/language_help_formatter.rb', line 34 def visit_multiline_arg(table) if @options[:incomplete] @io.puts(format_string(INCOMPLETE, :failed)) end super end |
#visit_table_cell_value(value, status) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/cucumber/cli/language_help_formatter.rb', line 46 def visit_table_cell_value(value, status) if @col == 1 if(@options[:check_lang]) @incomplete = Parser::I18n::Language[value].incomplete? end status = :comment elsif @incomplete status = :undefined end @col += 1 super(value, status) end |
#visit_table_row(table_row) ⇒ Object
41 42 43 44 |
# File 'lib/cucumber/cli/language_help_formatter.rb', line 41 def visit_table_row(table_row) @col = 1 super end |