Class: Cuker::JiraMonoModel
- Inherits:
-
JiraModel
- Object
- AbstractModel
- JiraModel
- Cuker::JiraMonoModel
- Includes:
- LoggerSetup
- Defined in:
- lib/cuker/helpers/formatters/jira_mono_model.rb
Constant Summary
Constants inherited from JiraModel
Cuker::JiraModel::JIRA_BLANK, Cuker::JiraModel::JIRA_EMPTY_LINE, Cuker::JiraModel::JIRA_HORIZ_RULER, Cuker::JiraModel::JIRA_ICONS, Cuker::JiraModel::JIRA_NEW_LINE, Cuker::JiraModel::JIRA_ROW_SEP, Cuker::JiraModel::JIRA_TITLE_SEP, Cuker::JiraModel::TITLE_MAX_LEN
Constants inherited from AbstractModel
AbstractModel::AND, AbstractModel::BACKGROUND, AbstractModel::BUT, AbstractModel::EXAMPLES, AbstractModel::FEATURE, AbstractModel::GIVEN, AbstractModel::SCENARIO, AbstractModel::SCENARIO_OUTLINE, AbstractModel::THEN, AbstractModel::WHEN
Instance Attribute Summary
Attributes included from LoggerSetup
Attributes inherited from AbstractModel
Instance Method Summary collapse
- #in_step(steps) ⇒ Object
-
#in_step_args(arg) ⇒ Object
helps handle tables for now.
- #in_table_cell(cell_hsh) ⇒ Object
- #jira_monospace(str) ⇒ Object
Methods included from LoggerSetup
#init_logger, reset_appender_log_levels
Methods inherited from JiraModel
Methods included from StringHelper
#add_newlines, #add_newlines!, #add_newlines_regex
Methods inherited from AbstractModel
#get_keys_ary, #get_tags, #get_values_ary, #initialize, #name_merge, #simple_surround, #surround, #union
Methods included from Interface
Constructor Details
This class inherits a constructor from Cuker::JiraModel
Instance Method Details
#in_step(steps) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/cuker/helpers/formatters/jira_mono_model.rb', line 16 def in_step(steps) steps.each do |step| if step[:type] == :Step step_ary = [] step_str = [ (jira_monospace(jira_bold(step[:keyword].strip)).rjust(11)), # bolding the keywords jira_monospace(step[:text].strip) ].join(' ') # step_ary << jira_monospace(step_str) step_ary << (step_str) step_ary += in_step_args(step[:argument]) if step[:argument] # todo: padding as needed yield step_ary else @log.warn "Unknown type '#{item[:type]}' found in file @ #{@file_path}" end end end |
#in_step_args(arg) ⇒ Object
helps handle tables for now
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/cuker/helpers/formatters/jira_mono_model.rb', line 38 def in_step_args arg if arg[:type] == :DataTable res = [] arg[:rows].each_with_index do |row, i| sep = i == 0 ? '||' : '|' res << surround(row[:cells].map {|hsh| jira_monospace(jira_blank_pad hsh[:value])}, sep) end return res elsif arg[:type] == :DocString # todo: handle if needed @log.warn "Docstrings found in '#{arg}' found in file @ #{@file_path}" else @log.warn "Unknown type '#{arg[:type]}' found in file @ #{@file_path}" end [] end |
#in_table_cell(cell_hsh) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/cuker/helpers/formatters/jira_mono_model.rb', line 6 def in_table_cell cell_hsh if cell_hsh[:type] == :TableCell val = cell_hsh[:value].strip val.empty? ? JIRA_BLANK : jira_monospace(val) else @log.warn "Expected :TableCell in #{cell_hsh} @ #{@file_path}" JIRA_BLANK end end |
#jira_monospace(str) ⇒ Object
55 56 57 |
# File 'lib/cuker/helpers/formatters/jira_mono_model.rb', line 55 def jira_monospace str simple_surround str, '{{', '}}' end |