class Minimart::Output
Wrapper for IO to provide colored output.
Attributes
io[R]
Public Class Methods
new(io)
click to toggle source
# File lib/minimart/output.rb, line 7 def initialize(io) @io = io end
Public Instance Methods
puts(*args)
click to toggle source
# File lib/minimart/output.rb, line 11 def puts(*args) io.puts(args) end
puts_green(str)
click to toggle source
# File lib/minimart/output.rb, line 19 def puts_green(str) puts_color(32, str) end
puts_red(str)
click to toggle source
# File lib/minimart/output.rb, line 15 def puts_red(str) puts_color(31, str) end
puts_yellow(str)
click to toggle source
# File lib/minimart/output.rb, line 23 def puts_yellow(str) puts_color(33, str) end
Private Instance Methods
puts_color(color_code, str)
click to toggle source
# File lib/minimart/output.rb, line 29 def puts_color(color_code, str) self.puts "\e[#{color_code}m#{str}\e[0m" end