Class: Fractor::Work
- Inherits:
-
Object
- Object
- Fractor::Work
- Defined in:
- lib/fractor/work.rb
Overview
Base class for defining work items. Contains the input data for a worker.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#initialize(input, timeout: nil) ⇒ Work
constructor
Initializes a new work item.
-
#inspect ⇒ String
Provide detailed inspection of work item for debugging.
- #to_s ⇒ Object
Constructor Details
#initialize(input, timeout: nil) ⇒ Work
Initializes a new work item.
14 15 16 17 |
# File 'lib/fractor/work.rb', line 14 def initialize(input, timeout: nil) @input = input @timeout = timeout end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
7 8 9 |
# File 'lib/fractor/work.rb', line 7 def input @input end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
7 8 9 |
# File 'lib/fractor/work.rb', line 7 def timeout @timeout end |
Instance Method Details
#inspect ⇒ String
Provide detailed inspection of work item for debugging
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/fractor/work.rb', line 25 def inspect details = [ "#<#{self.class.name}", "0x#{(object_id << 1).to_s(16)}", "@input=#{@input.inspect}", "@type=#{input.class.name}", ] details << "@timeout=#{@timeout.inspect}" if @timeout details.join(" ") end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/fractor/work.rb', line 19 def to_s "Work: #{@input}" end |