Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/paramsync.rb
Overview
monkeypatch String for display prettiness
Instance Method Summary collapse
- #blue ⇒ Object
- #bold ⇒ Object
- #colorize(s, e = 0) ⇒ Object
- #cyan ⇒ Object
- #gray ⇒ Object
- #green ⇒ Object
- #magenta ⇒ Object
- #red ⇒ Object
-
#trim_path ⇒ Object
trim_path replaces the HOME directory on an absolute path with ‘~’.
Instance Method Details
#blue ⇒ Object
54 55 56 |
# File 'lib/paramsync.rb', line 54 def blue colorize(34) end |
#bold ⇒ Object
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 |
#cyan ⇒ Object
62 63 64 |
# File 'lib/paramsync.rb', line 62 def cyan colorize(36) end |
#gray ⇒ Object
66 67 68 |
# File 'lib/paramsync.rb', line 66 def gray colorize(37) end |
#green ⇒ Object
50 51 52 |
# File 'lib/paramsync.rb', line 50 def green colorize(32) end |
#magenta ⇒ Object
58 59 60 |
# File 'lib/paramsync.rb', line 58 def magenta colorize(35) end |
#red ⇒ Object
46 47 48 |
# File 'lib/paramsync.rb', line 46 def red colorize(31) end |
#trim_path ⇒ Object
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 |