Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/bookmarks.rb
Overview
thx danhassin
Instance Method Summary collapse
- #blue ⇒ Object
- #colorize(color, mod) ⇒ Object
- #green ⇒ Object
- #reset ⇒ Object
- #white ⇒ Object
- #window(width) ⇒ Object
Instance Method Details
#blue ⇒ Object
31 |
# File 'lib/bookmarks.rb', line 31 def blue() colorize(34,0) end |
#colorize(color, mod) ⇒ Object
16 17 18 |
# File 'lib/bookmarks.rb', line 16 def colorize(color, mod) "\033[#{mod};#{color};49m#{self}\033[0;0m" end |
#green ⇒ Object
30 |
# File 'lib/bookmarks.rb', line 30 def green() colorize(32,0) end |
#reset ⇒ Object
28 |
# File 'lib/bookmarks.rb', line 28 def reset() colorize(0,0) end |
#white ⇒ Object
29 |
# File 'lib/bookmarks.rb', line 29 def white() colorize(37,1) end |
#window(width) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/bookmarks.rb', line 20 def window(width) if self.length >= width self[0..width-1] else self.ljust(width) end end |