Module: RBText::Formatting

Included in:
F
Defined in:
lib/rbtext/formatting.rb

Class Method Summary collapse

Class Method Details

.blinkingObject



29
30
31
# File 'lib/rbtext/formatting.rb', line 29

def blinking
  "\033[5m"
end

.boldObject



13
14
15
# File 'lib/rbtext/formatting.rb', line 13

def bold
  "\033[1m"
end

.faintObject



17
18
19
# File 'lib/rbtext/formatting.rb', line 17

def faint
  "\033[2m"
end

.italicObject



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

def italic
  "\033[3m"
end

.reset(f_opt = nil) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/rbtext/formatting.rb', line 3

def reset(f_opt = nil)
  if f_opt
    "\033[#{
      f_opt =~ /^\033\[(1|2)m$/ ? "\033[22m" : "\033[2#{f_opt.gsub(/[^0-9]/, "")}m"
    }"
  else
    "\033[0m"
  end
end

.strikethroughObject



33
34
35
# File 'lib/rbtext/formatting.rb', line 33

def strikethrough
  "\033[9m"
end

.underlineObject



25
26
27
# File 'lib/rbtext/formatting.rb', line 25

def underline
  "\033[4m"
end