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

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.wrapBoolean

Determines whether wrapping should be enabled.

Returns:

  • (Boolean)


8
9
10
# File 'lib/cliutils/pretty_io.rb', line 8

def wrap
  @wrap
end

.wrap_char_limitInteger

Determines when strings should begin to wrap

Returns:

  • (Integer)


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.

Parameters:

  • k (Object)

    The includer object



21
22
23
# File 'lib/cliutils/pretty_io.rb', line 21

def self.included(k)
  k.extend(self)
end

Instance Method Details

#color_chartvoid

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