Class: Specwrk::WorkerStore
- Inherits:
-
Store
- Object
- Store
- Specwrk::WorkerStore
show all
- Defined in:
- lib/specwrk/store/worker_store.rb
Constant Summary
collapse
- FIRST_SEEN_AT_KEY =
:____first_seen_at_key
- LAST_SEEN_AT_KEY =
:____last_seen_at_key
Instance Method Summary
collapse
Methods inherited from Store
#[], #[]=, adapter_klass, #any?, #clear, #delete, #empty?, #initialize, #inspect, #keys, #length, #merge!, #multi_read, #to_h, with_lock
Constructor Details
This class inherits a constructor from Specwrk::Store
Instance Method Details
#first_seen_at ⇒ Object
17
18
19
20
21
22
23
24
|
# File 'lib/specwrk/store/worker_store.rb', line 17
def first_seen_at
@first_seen_at ||= begin
value = self[FIRST_SEEN_AT_KEY]
return @first_seen_at = value unless value
@first_seen_at = Time.at(value.to_i)
end
end
|
#first_seen_at=(val) ⇒ Object
11
12
13
14
15
|
# File 'lib/specwrk/store/worker_store.rb', line 11
def first_seen_at=(val)
@first_seen_at = nil
self[FIRST_SEEN_AT_KEY] = val.to_i
end
|
#last_seen_at ⇒ Object
32
33
34
35
36
37
38
39
|
# File 'lib/specwrk/store/worker_store.rb', line 32
def last_seen_at
@last_seen_at ||= begin
value = self[LAST_SEEN_AT_KEY]
return @last_seen_at = value unless value
@last_seen_at = Time.at(value.to_i)
end
end
|
#last_seen_at=(val) ⇒ Object
26
27
28
29
30
|
# File 'lib/specwrk/store/worker_store.rb', line 26
def last_seen_at=(val)
@last_seen_at = nil
self[LAST_SEEN_AT_KEY] = val.to_i
end
|
#reload ⇒ Object
41
42
43
44
45
|
# File 'lib/specwrk/store/worker_store.rb', line 41
def reload
@last_seen_at = nil
@first_seen_at = nil
super
end
|