Class: String

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

Overview

monkeypatch String for display prettiness

Instance Method Summary collapse

Instance Method Details

#blueObject



54
55
56
# File 'lib/paramsync.rb', line 54

def blue
  colorize(34)
end

#boldObject



70
71
72
# File 'lib/paramsync.rb', line 70

def bold
  colorize(1,22)
end

#colorize(s, e = 0) ⇒ Object



42
43
44
# File 'lib/paramsync.rb', line 42

def colorize(s,e=0)
  Paramsync.config.color? ? "\e[#{s}m#{self}\e[#{e}m" : self
end

#cyanObject



62
63
64
# File 'lib/paramsync.rb', line 62

def cyan
  colorize(36)
end

#grayObject



66
67
68
# File 'lib/paramsync.rb', line 66

def gray
  colorize(37)
end

#greenObject



50
51
52
# File 'lib/paramsync.rb', line 50

def green
  colorize(32)
end

#magentaObject



58
59
60
# File 'lib/paramsync.rb', line 58

def magenta
  colorize(35)
end

#redObject



46
47
48
# File 'lib/paramsync.rb', line 46

def red
  colorize(31)
end

#trim_pathObject

trim_path replaces the HOME directory on an absolute path with ‘~’



38
39
40
# File 'lib/paramsync.rb', line 38

def trim_path
  self.sub(%r(^#{ENV['HOME']}), '~')
end