Class: Dizby::TimedIdConverter
- Inherits:
-
Object
- Object
- Dizby::TimedIdConverter
- Defined in:
- lib/dizby/converter/timed.rb
Instance Method Summary collapse
-
#initialize(timeout = 600_000, step = 30_000) ⇒ TimedIdConverter
constructor
default timeout: 10 minutes, default step: 30 seconds.
- #to_id(obj)
- #to_obj(ref)
Constructor Details
#initialize(timeout = 600_000, step = 30_000) ⇒ TimedIdConverter
default timeout: 10 minutes, default step: 30 seconds
14 15 16 |
# File 'lib/dizby/converter/timed.rb', line 14 def initialize(timeout = 600_000, step = 30_000) @collection = TimedCollection.new(timeout, step) end |
Instance Method Details
#to_id(obj)
23 24 25 26 27 |
# File 'lib/dizby/converter/timed.rb', line 23 def to_id(obj) key = IdConverter.to_id(obj) @collection.add(key) key end |
#to_obj(ref)
18 19 20 21 |
# File 'lib/dizby/converter/timed.rb', line 18 def to_obj(ref) @collection.revive(ref) IdConverter.to_obj(ref) end |