Class: AssistedWorkflow::Output
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- AssistedWorkflow::Output
- Defined in:
- lib/assisted_workflow/output.rb
Overview
a helper class to provide custom shell print methods
Instance Method Summary collapse
-
#initialize(shell) ⇒ Output
constructor
A new instance of Output.
- #next_command(title, commands) {|_commands| ... } ⇒ Object
-
#print_stories(title, stories, options = {}) ⇒ Object
prints as table with stories data.
- #print_story(story) ⇒ Object
-
#print_title(title) ⇒ Object
prints a highlighted title section.
-
#say_comment(comment) ⇒ Object
prints a wrapped gray line, showing as comments between log lines.
Constructor Details
#initialize(shell) ⇒ Output
Returns a new instance of Output.
5 6 7 8 |
# File 'lib/assisted_workflow/output.rb', line 5 def initialize(shell) super @shell = shell end |
Instance Method Details
#next_command(title, commands) {|_commands| ... } ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/assisted_workflow/output.rb', line 44 def next_command(title, commands, &block) say title, :green _commands = Array(commands) yield(_commands) if block_given? _commands.each do |command| print_wrapped command, :indent => 2 end end |
#print_stories(title, stories, options = {}) ⇒ Object
prints as table with stories data
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/assisted_workflow/output.rb', line 25 def print_stories(title, stories, = {}) print_title title rows = stories.map do |story| if [:all] [story.id, story.current_state, story.name] else [story.id, story.estimate, story.name] end end print_table(rows) end |
#print_story(story) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/assisted_workflow/output.rb', line 37 def print_story(story) say "-" * 40 print_wrapped story.name.to_s, :indent => 2 print_wrapped story.description.to_s, :indent => 2 say "-" * 40 end |
#print_title(title) ⇒ Object
prints a highlighted title section
18 19 20 21 22 |
# File 'lib/assisted_workflow/output.rb', line 18 def print_title(title) say "-" * title.length, :green say title.upcase, :green say "-" * title.length, :green end |
#say_comment(comment) ⇒ Object
prints a wrapped gray line, showing as comments between log lines
11 12 13 14 15 |
# File 'lib/assisted_workflow/output.rb', line 11 def say_comment(comment) @shell.padding = 4 say comment, [:black, :bold] @shell.padding = 0 end |