Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/dvla/herodotus/string.rb

Instance Method Summary collapse

Instance Method Details

#bg_blackObject



44
# File 'lib/dvla/herodotus/string.rb', line 44

def bg_black = colourise(40, 49)

#bg_blueObject



54
# File 'lib/dvla/herodotus/string.rb', line 54

def bg_blue = colourise(44, 49)

#bg_bright_blueObject



68
# File 'lib/dvla/herodotus/string.rb', line 68

def bg_bright_blue = colourise(104, 49)

#bg_bright_cyanObject



72
# File 'lib/dvla/herodotus/string.rb', line 72

def bg_bright_cyan = colourise(106, 49)

#bg_bright_greenObject



66
# File 'lib/dvla/herodotus/string.rb', line 66

def bg_bright_green = colourise(102, 49)

#bg_bright_magentaObject



70
# File 'lib/dvla/herodotus/string.rb', line 70

def bg_bright_magenta = colourise(105, 49)

#bg_bright_redObject



64
# File 'lib/dvla/herodotus/string.rb', line 64

def bg_bright_red = colourise(101, 49)

#bg_brownObject



50
# File 'lib/dvla/herodotus/string.rb', line 50

def bg_brown = colourise(43, 49)

#bg_cyanObject



58
# File 'lib/dvla/herodotus/string.rb', line 58

def bg_cyan = colourise(46, 49)

#bg_grayObject Also known as: bg_grey



60
# File 'lib/dvla/herodotus/string.rb', line 60

def bg_gray = colourise(47, 49)

#bg_greenObject



48
# File 'lib/dvla/herodotus/string.rb', line 48

def bg_green = colourise(42, 49)

#bg_magentaObject



56
# File 'lib/dvla/herodotus/string.rb', line 56

def bg_magenta = colourise(45, 49)

#bg_redObject



46
# File 'lib/dvla/herodotus/string.rb', line 46

def bg_red = colourise(41, 49)

#bg_whiteObject



62
# File 'lib/dvla/herodotus/string.rb', line 62

def bg_white = colourise(107, 49)

#bg_yellowObject



52
# File 'lib/dvla/herodotus/string.rb', line 52

def bg_yellow = colourise(103, 49)

#blackObject



16
# File 'lib/dvla/herodotus/string.rb', line 16

def black = colourise(30)

#blueObject



26
# File 'lib/dvla/herodotus/string.rb', line 26

def blue = colourise(34)

#boldObject



74
# File 'lib/dvla/herodotus/string.rb', line 74

def bold = colourise(1, 22)

#bright_blueObject



38
# File 'lib/dvla/herodotus/string.rb', line 38

def bright_blue = colourise(94)

#bright_cyanObject



42
# File 'lib/dvla/herodotus/string.rb', line 42

def bright_cyan = colourise(96)

#bright_greenObject



36
# File 'lib/dvla/herodotus/string.rb', line 36

def bright_green = colourise(92)

#bright_magentaObject



40
# File 'lib/dvla/herodotus/string.rb', line 40

def bright_magenta = colourise(95)

#bright_redObject



34
# File 'lib/dvla/herodotus/string.rb', line 34

def bright_red = colourise(91)

#brownObject



22
# File 'lib/dvla/herodotus/string.rb', line 22

def brown = colourise(33)

#colourise(code, reset_code = 39) ⇒ Object Also known as: colorize



4
5
6
7
8
9
10
11
12
# File 'lib/dvla/herodotus/string.rb', line 4

def colourise(code, reset_code = 39)
  # Making sure we align the correct reset codes
  if self.include?("\e[#{reset_code}m")
    result = self.gsub("\e[#{reset_code}m", "\e[#{reset_code}m\e[#{code}m")
    "\e[#{code}m#{result}\e[#{reset_code}m"
  else
    "\e[#{code}m#{self}\e[#{reset_code}m"
  end
end

#configObject

Semantic logging methods - apply colours based on message type



95
96
97
# File 'lib/dvla/herodotus/string.rb', line 95

def config
  send(DVLA::Herodotus::SemanticColours.config)
end

#cyanObject



30
# File 'lib/dvla/herodotus/string.rb', line 30

def cyan = colourise(36)

#dataObject



111
112
113
# File 'lib/dvla/herodotus/string.rb', line 111

def data
  send(DVLA::Herodotus::SemanticColours.data)
end

#dimObject



76
# File 'lib/dvla/herodotus/string.rb', line 76

def dim = colourise(2, 22)

#grayObject Also known as: grey



32
# File 'lib/dvla/herodotus/string.rb', line 32

def gray = colourise(37)

#greenObject



20
# File 'lib/dvla/herodotus/string.rb', line 20

def green = colourise(32)

#italicObject



78
# File 'lib/dvla/herodotus/string.rb', line 78

def italic = colourise(3, 23)

#magentaObject



28
# File 'lib/dvla/herodotus/string.rb', line 28

def magenta = colourise(35)

#redObject



18
# File 'lib/dvla/herodotus/string.rb', line 18

def red = colourise(31)

#reverse_colourObject Also known as: reverse_color



82
# File 'lib/dvla/herodotus/string.rb', line 82

def reverse_colour = colourise(7, 27)

#stepObject



99
100
101
# File 'lib/dvla/herodotus/string.rb', line 99

def step
  send(DVLA::Herodotus::SemanticColours.step)
end

#strip_colourObject Also known as: strip_color



84
85
86
# File 'lib/dvla/herodotus/string.rb', line 84

def strip_colour
  gsub(/\e\[[0-9;]*m/, '')
end

#successObject



103
104
105
# File 'lib/dvla/herodotus/string.rb', line 103

def success
  send(DVLA::Herodotus::SemanticColours.success)
end

#underlineObject



80
# File 'lib/dvla/herodotus/string.rb', line 80

def underline = colourise(4, 24)

#warningObject



107
108
109
# File 'lib/dvla/herodotus/string.rb', line 107

def warning
  send(DVLA::Herodotus::SemanticColours.warning)
end

#whiteObject



14
# File 'lib/dvla/herodotus/string.rb', line 14

def white = colourise(97)

#yellowObject



24
# File 'lib/dvla/herodotus/string.rb', line 24

def yellow = colourise(93)