Class: Tty

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

Class Method Summary collapse

Class Method Details

.blueObject



3
4
5
# File 'lib/zq/utils.rb', line 3

def blue
  bold 34
end

.emObject



23
24
25
# File 'lib/zq/utils.rb', line 23

def em
  underline 39
end

.grayObject



31
32
33
# File 'lib/zq/utils.rb', line 31

def gray
  bold 30
end

.greenObject



27
28
29
# File 'lib/zq/utils.rb', line 27

def green
  color 92
end

.redObject



11
12
13
# File 'lib/zq/utils.rb', line 11

def red
  underline 31
end

.resetObject



19
20
21
# File 'lib/zq/utils.rb', line 19

def reset
  escape 0
end

.truncate(str) ⇒ Object



39
40
41
# File 'lib/zq/utils.rb', line 39

def truncate(str)
  str.to_s[0, width - 4]
end

.whiteObject



7
8
9
# File 'lib/zq/utils.rb', line 7

def white
  bold 39
end

.widthObject



35
36
37
# File 'lib/zq/utils.rb', line 35

def width
  `/usr/bin/tput cols`.strip.to_i
end

.yellowObject



15
16
17
# File 'lib/zq/utils.rb', line 15

def yellow
  underline 33
end