Class: Utils::ProbeServer::Job
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
- #ok ⇒ Object
Instance Method Summary collapse
-
#initialize(probe_server, args) ⇒ Job
constructor
A new instance of Job.
- #inspect ⇒ Object (also: #to_s)
- #ok_colorize(string) ⇒ Object
Constructor Details
#initialize(probe_server, args) ⇒ Job
Returns a new instance of Job.
10 11 12 13 |
# File 'lib/utils/probe_server.rb', line 10 def initialize(probe_server, args) @id = probe_server.next_job_id @args = Array(args) end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
17 18 19 |
# File 'lib/utils/probe_server.rb', line 17 def args @args end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
15 16 17 |
# File 'lib/utils/probe_server.rb', line 15 def id @id end |
#ok ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/utils/probe_server.rb', line 21 def ok case @ok when false then 'n' when true then 'y' else '…' end end |
Instance Method Details
#inspect ⇒ Object Also known as: to_s
37 38 39 |
# File 'lib/utils/probe_server.rb', line 37 def inspect ok_colorize("#{id} #{args.map { |a| a.include?(' ') ? a.inspect : a } * ' '}") end |
#ok_colorize(string) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/utils/probe_server.rb', line 29 def ok_colorize(string) case @ok when false then string.white.on_red when true then string.black.on_green else string end end |