Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/xcselect/string_colors.rb

Instance Method Summary collapse

Instance Method Details

#blueObject



8
# File 'lib/xcselect/string_colors.rb', line 8

def blue; colorize(self, "\e[1m\e[34m"); end

#colorize(text, color_code) ⇒ Object



12
13
14
# File 'lib/xcselect/string_colors.rb', line 12

def colorize(text, color_code)  
  (STDIN.tty?) ? "#{color_code}#{text}\e[0m" : text
end

#dark_blueObject



9
# File 'lib/xcselect/string_colors.rb', line 9

def dark_blue; colorize(self, "\e[34m"); end

#dark_greenObject



5
# File 'lib/xcselect/string_colors.rb', line 5

def dark_green; colorize(self, "\e[32m"); end

#dark_purObject



11
# File 'lib/xcselect/string_colors.rb', line 11

def dark_pur; colorize(self, "\e[35m"); end

#dark_redObject



3
# File 'lib/xcselect/string_colors.rb', line 3

def dark_red; colorize(self, "\e\[31m"); end

#dark_yellowObject



7
# File 'lib/xcselect/string_colors.rb', line 7

def dark_yellow; colorize(self, "\e[33m"); end

#greenObject



4
# File 'lib/xcselect/string_colors.rb', line 4

def green; colorize(self, "\e[1m\e[32m"); end

#numeric?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/xcselect/string_colors.rb', line 16

def numeric?
  true if Float(self) rescue false
end

#purObject



10
# File 'lib/xcselect/string_colors.rb', line 10

def pur; colorize(self, "\e[1m\e[35m"); end

#redObject



2
# File 'lib/xcselect/string_colors.rb', line 2

def red; colorize(self, "\e[1m\e[31m"); end

#yellowObject



6
# File 'lib/xcselect/string_colors.rb', line 6

def yellow; colorize(self, "\e[1m\e[33m"); end