Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/hardhat/ext/string.rb

Instance Method Summary collapse

Instance Method Details

#blackObject



7
# File 'lib/hardhat/ext/string.rb', line 7

def black; self.colorize(30); end

#blueObject



11
# File 'lib/hardhat/ext/string.rb', line 11

def blue; self.colorize(34); end

#colorize(color_code) ⇒ Object



3
4
5
# File 'lib/hardhat/ext/string.rb', line 3

def colorize(color_code)
  "\e[#{color_code}m#{self}\e[0m"
end

#cyanObject



13
# File 'lib/hardhat/ext/string.rb', line 13

def cyan; self.colorize(36); end

#greenObject



9
# File 'lib/hardhat/ext/string.rb', line 9

def green; self.colorize(32); end

#magentaObject



12
# File 'lib/hardhat/ext/string.rb', line 12

def magenta; self.colorize(35); end

#redObject



8
# File 'lib/hardhat/ext/string.rb', line 8

def red; self.colorize(31); end

#whiteObject



14
# File 'lib/hardhat/ext/string.rb', line 14

def white; self.colorize(37); end

#yellowObject



10
# File 'lib/hardhat/ext/string.rb', line 10

def yellow; self.colorize(33); end