class Output
Output
is a Singleton. Get the instance via ‘Output.instance`
Constants
- WARNING
Public Class Methods
activate_centering()
click to toggle source
# File lib/exogenesis/support/output.rb, line 26 def self.activate_centering puts WARNING end
activate_decoration()
click to toggle source
# File lib/exogenesis/support/output.rb, line 30 def self.activate_decoration puts WARNING end
activate_utf8()
click to toggle source
# File lib/exogenesis/support/output.rb, line 34 def self.activate_utf8 puts WARNING end
fancy()
click to toggle source
# File lib/exogenesis/support/output.rb, line 22 def self.fancy puts WARNING end
new()
click to toggle source
# File lib/exogenesis/support/output.rb, line 15 def initialize @canvas = CenteredCanvas.new(STDOUT) @success_node = EmojiNode.new(:thumbsup) @failure_node = EmojiNode.new(:thumbsdown) @skipped_node = EmojiNode.new(:point_right) end
Public Instance Methods
decorated_header(text, emoji_name)
click to toggle source
Print the text as a decorated header
# File lib/exogenesis/support/output.rb, line 39 def decorated_header(text, emoji_name) emoji = EmojiNode.new(emoji_name) header = Node.new(emoji, ' ', BoldNode.new(text), ' ', emoji) @canvas.draw_centered_row(header) end
end_border()
click to toggle source
Draw the lower bound of a border
# File lib/exogenesis/support/output.rb, line 83 def end_border puts "\u2514#{"\u2500" * (terminal_width - 2)}\u2518" end
failure(info)
click to toggle source
Print the right side with a failure message
# File lib/exogenesis/support/output.rb, line 59 def failure(info) failure = Node.new(' ', info, ' ', @failure_node) @canvas.draw_right_column(failure) end
info(info)
click to toggle source
Print some arbitrary information on the right
# File lib/exogenesis/support/output.rb, line 71 def info(info) info_node = Node.new(' ', info) @canvas.draw_right_column(info_node) end
left(text)
click to toggle source
Print the left side of an output
# File lib/exogenesis/support/output.rb, line 46 def left(text) text_with_colon = Node.new(text, ':') left = ColorNode.new(:white, BoldNode.new(text_with_colon)) @canvas.draw_left_column(left) end
skipped(_info)
click to toggle source
Print the right side with a skipped message
# File lib/exogenesis/support/output.rb, line 65 def skipped(_info) skipped = Node.new(' ', @skipped_node) @canvas.draw_right_column(skipped) end
start_border(info)
click to toggle source
Draw the upper bound of a border
# File lib/exogenesis/support/output.rb, line 77 def start_border(info) width = (terminal_width - 4 - info.length) / 2 puts "\u250C#{("\u2500" * width)} #{info} #{("\u2500" * width)}\u2510" end
success(_info)
click to toggle source
Print the right side with a success message
# File lib/exogenesis/support/output.rb, line 53 def success(_info) success = Node.new(' ', @success_node) @canvas.draw_right_column(success) end
Private Instance Methods
terminal_width()
click to toggle source
Determine the width of the terminal
# File lib/exogenesis/support/output.rb, line 90 def terminal_width Integer(`tput cols`) end