Module: Kolorit

Defined in:
lib/kolorit.rb,
lib/kolorit/linux.rb,
lib/kolorit/version.rb

Overview

Handle modules with color codes and methods to colorize string. Right module is included depending on user OS.

Examples:

(opt 1) - Require everything and override String class

require 'kolorit' => include color methods in class String

(opt 2) - Require what you need, include where you need it

require 'kolorit/linux' => just require, no override
include Kolorit::Linux => use color methods in your class

Colorize string

'I am mr Red String'.red
'I am mr Green String'.green
'I am bold (fat) mis Pink String'.pink.bold

Available colors

red, green, yellow, blue, pink, cyan, gray

Available styles

bold, italic, underline, blink, reverse_color

Defined Under Namespace

Modules: Linux

Constant Summary collapse

VERSION =

gem version

'0.1.5'

Class Method Summary collapse

Class Method Details

.env_os_win?Boolean

Returns:



29
30
31
# File 'lib/kolorit.rb', line 29

def env_os_win?
  ENV['OS'] == 'Windows_NT'
end

.on_windows?Boolean Also known as: windows?

Returns:



33
34
35
36
37
38
39
40
41
# File 'lib/kolorit.rb', line 33

def on_windows?
  if env_os_win?
    return false if RUBY_PLATFORM =~ /cygwin/

    true
  else
    false
  end
end