Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/aka/string.rb
Instance Method Summary collapse
- #blue ⇒ Object
- #colorize(color_code) ⇒ Object
- #green ⇒ Object
- #is_i? ⇒ Boolean
- #light_blue ⇒ Object
- #pink ⇒ Object
- #pretty ⇒ Object
- #red ⇒ Object
- #yellow ⇒ Object
Instance Method Details
#blue ⇒ Object
61 62 63 |
# File 'lib/aka/string.rb', line 61 def blue colorize(34) end |
#colorize(color_code) ⇒ Object
45 46 47 |
# File 'lib/aka/string.rb', line 45 def colorize(color_code) "\e[#{color_code}m#{self}\e[0m" end |
#green ⇒ Object
53 54 55 |
# File 'lib/aka/string.rb', line 53 def green colorize(32) end |
#is_i? ⇒ Boolean
41 42 43 |
# File 'lib/aka/string.rb', line 41 def is_i? !!(self =~ /\A[-+]?[0-9]+\z/) end |
#light_blue ⇒ Object
69 70 71 |
# File 'lib/aka/string.rb', line 69 def light_blue colorize(36) end |
#pink ⇒ Object
65 66 67 |
# File 'lib/aka/string.rb', line 65 def pink colorize(35) end |
#pretty ⇒ Object
37 38 39 |
# File 'lib/aka/string.rb', line 37 def pretty self.gsub("\s\t\r\f", ' ').squeeze(' ') end |
#red ⇒ Object
49 50 51 |
# File 'lib/aka/string.rb', line 49 def red colorize(31) end |
#yellow ⇒ Object
57 58 59 |
# File 'lib/aka/string.rb', line 57 def yellow colorize(33) end |