Class: Utils::ProbeServer::Job
Class Attribute Summary collapse
-
.colorize ⇒ Object
writeonly
Sets the attribute colorize.
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
- #ok ⇒ Object
Class Method Summary collapse
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.
20 21 22 23 |
# File 'lib/utils/probe_server.rb', line 20 def initialize(probe_server, args) @id = probe_server.next_job_id @args = args end |
Class Attribute Details
.colorize=(value) ⇒ Object (writeonly)
Sets the attribute colorize
12 13 14 |
# File 'lib/utils/probe_server.rb', line 12 def colorize=(value) @colorize = value end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
27 28 29 |
# File 'lib/utils/probe_server.rb', line 27 def args @args end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
25 26 27 |
# File 'lib/utils/probe_server.rb', line 25 def id @id end |
#ok ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/utils/probe_server.rb', line 31 def ok case @ok when false then 'n' when true then 'y' else '…' end end |
Class Method Details
.colorize? ⇒ Boolean
14 15 16 |
# File 'lib/utils/probe_server.rb', line 14 def colorize? !!@colorize end |
Instance Method Details
#inspect ⇒ Object Also known as: to_s
48 49 50 51 52 |
# File 'lib/utils/probe_server.rb', line 48 def inspect ok_colorize( "#<Job id=#{id} args=#{args.inspect} ok=#{ok}>" ) end |
#ok_colorize(string) ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/utils/probe_server.rb', line 39 def ok_colorize(string) return string unless self.class.colorize? case @ok when false then string.white.on_red when true then string.black.on_green else string.black.on_yellow end end |