Class: String

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

Overview

add some colors, windowing methods

Instance Method Summary collapse

Instance Method Details

#bluObject



26
# File 'lib/bookmarks.rb', line 26

def blu() colorize(34,0) end

#colorize(color, mod) ⇒ Object

thx danhassin/dingbat



21
22
23
# File 'lib/bookmarks.rb', line 21

def colorize(color, mod)
  "\033[#{mod};#{color};49m#{self}\033[0;0m"
end

#grnObject



28
# File 'lib/bookmarks.rb', line 28

def grn() colorize(32,0) end

#redObject



29
# File 'lib/bookmarks.rb', line 29

def red() colorize(31,0) end

#resetObject



25
# File 'lib/bookmarks.rb', line 25

def reset() colorize(0,0) end

#window(width) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/bookmarks.rb', line 12

def window(width)
  if self.length >= width
    self[0..width-1]
  else
    self.ljust(width)
  end
end

#yelObject



27
# File 'lib/bookmarks.rb', line 27

def yel() colorize(33,0) end