Module: CLIUtils::PrettyIO
- Included in:
- Messenger
- Defined in:
- lib/cliutils/pretty_io.rb
Overview
CLIMessenger Module Outputs color-coordinated messages to a CLI
Class Attribute Summary collapse
-
.wrap ⇒ Boolean
Determines whether wrapping should be enabled.
-
.wrap_char_limit ⇒ Integer
Determines when strings should begin to wrap.
Class Method Summary collapse
-
.included(k) ⇒ void
Hook that triggers when this module is included.
Instance Method Summary collapse
-
#color_chart ⇒ void
Displays a chart of all the possible ANSI foreground and background color combinations.
Class Attribute Details
.wrap ⇒ Boolean
Determines whether wrapping should be enabled.
8 9 10 |
# File 'lib/cliutils/pretty_io.rb', line 8 def wrap @wrap end |
.wrap_char_limit ⇒ Integer
Determines when strings should begin to wrap
12 13 14 |
# File 'lib/cliutils/pretty_io.rb', line 12 def wrap_char_limit @wrap_char_limit end |
Class Method Details
.included(k) ⇒ void
This method returns an undefined value.
Hook that triggers when this module is included.
21 22 23 |
# File 'lib/cliutils/pretty_io.rb', line 21 def self.included(k) k.extend(self) end |
Instance Method Details
#color_chart ⇒ void
This method returns an undefined value.
Displays a chart of all the possible ANSI foreground and background color combinations.
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/cliutils/pretty_io.rb', line 28 def color_chart [0, 1, 4, 5, 7].each do |attr| puts '----------------------------------------------------------------' puts "ESC[#{attr};Foreground;Background" 30.upto(37) do |fg| 40.upto(47) do |bg| print "\033[#{attr};#{fg};#{bg}m #{fg};#{bg} " end puts "\033[0m" end end end |