Class: Zeusd::Log::Line::Base
- Inherits:
-
String
- Object
- String
- Zeusd::Log::Line::Base
show all
- Defined in:
- lib/zeusd/log/line/base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.matches_line?(line) ⇒ Boolean
8
9
10
|
# File 'lib/zeusd/log/line/base.rb', line 8
def self.matches_line?(line)
true
end
|
Instance Method Details
#ansi_color ⇒ Object
61
62
63
64
65
|
# File 'lib/zeusd/log/line/base.rb', line 61
def ansi_color
if self[0] == "\e" && !self.index('m').nil?
self[0..self.index('m')]
end
end
|
#ansi_color_of(substring) ⇒ Object
52
53
54
55
56
57
58
59
|
# File 'lib/zeusd/log/line/base.rb', line 52
def ansi_color_of(substring)
if stop_point = index(substring) + (substring.length - 1)
if color_start = rindex(/\e/, stop_point)
color_end = index('m', color_start)
self[color_start..color_end]
end
end
end
|
#connecting? ⇒ Boolean
40
41
42
|
# File 'lib/zeusd/log/line/base.rb', line 40
def connecting?
status? :connecting
end
|
#crashed? ⇒ Boolean
28
29
30
|
# File 'lib/zeusd/log/line/base.rb', line 28
def crashed?
status? :crashed
end
|
#done? ⇒ Boolean
48
49
50
|
# File 'lib/zeusd/log/line/base.rb', line 48
def done?
[:crashed, :ready].any? {|x| status? x}
end
|
#id ⇒ Object
16
17
18
|
# File 'lib/zeusd/log/line/base.rb', line 16
def id
self
end
|
#loading? ⇒ Boolean
44
45
46
|
# File 'lib/zeusd/log/line/base.rb', line 44
def loading?
[:waiting, :connecting, :running].any? {|x| status? x}
end
|
#ready? ⇒ Boolean
24
25
26
|
# File 'lib/zeusd/log/line/base.rb', line 24
def ready?
status? :ready
end
|
#running? ⇒ Boolean
36
37
38
|
# File 'lib/zeusd/log/line/base.rb', line 36
def running?
status? :running
end
|
#status?(status) ⇒ Boolean
20
21
22
|
# File 'lib/zeusd/log/line/base.rb', line 20
def status?(status)
ansi_color_of(status_substring) == Log::STATUS_TO_ANSI[status]
end
|
#status_substring ⇒ Object
12
13
14
|
# File 'lib/zeusd/log/line/base.rb', line 12
def status_substring
ansi_color
end
|
#waiting? ⇒ Boolean
32
33
34
|
# File 'lib/zeusd/log/line/base.rb', line 32
def waiting?
status? :waiting
end
|