Class: OFlow::Stamp
- Inherits:
-
Object
- Object
- OFlow::Stamp
- Defined in:
- lib/oflow/stamp.rb
Overview
Information used to identify a location and time that a Box was received. Stamps are placed in Trackers.
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Full name of Task that created the Stamp in a Tracker.
-
#op ⇒ Object
readonly
Operation that caused the Stamp to be created.
-
#time ⇒ Object
readonly
The time the Stamp was created.
Instance Method Summary collapse
-
#initialize(location, op = nil, time = nil) ⇒ Stamp
constructor
Create a new Stamp.
-
#to_s ⇒ Object
(also: #inspect)
Returns a String representation of the Stamp.
-
#where ⇒ Object
Returns a string composed of the location and operation.
Constructor Details
#initialize(location, op = nil, time = nil) ⇒ Stamp
Create a new Stamp.
21 22 23 24 25 |
# File 'lib/oflow/stamp.rb', line 21 def initialize(location, op=nil, time=nil) @location = location @op = op @time = (time || Time.now).utc end |
Instance Attribute Details
#location ⇒ Object (readonly)
Full name of Task that created the Stamp in a Tracker.
11 12 13 |
# File 'lib/oflow/stamp.rb', line 11 def location @location end |
#op ⇒ Object (readonly)
Operation that caused the Stamp to be created.
13 14 15 |
# File 'lib/oflow/stamp.rb', line 13 def op @op end |
#time ⇒ Object (readonly)
The time the Stamp was created.
15 16 17 |
# File 'lib/oflow/stamp.rb', line 15 def time @time end |
Instance Method Details
#to_s ⇒ Object Also known as: inspect
Returns a String representation of the Stamp.
33 34 35 |
# File 'lib/oflow/stamp.rb', line 33 def to_s() "#{@location}-#{@op}@#{@time.iso8601(9)}" end |
#where ⇒ Object
Returns a string composed of the location and operation.
28 29 30 |
# File 'lib/oflow/stamp.rb', line 28 def where() "#{@location}-#{@op}" end |