Class: Synced::Strategies::SyncedAllAtTimestampStrategy
- Inherits:
-
Object
- Object
- Synced::Strategies::SyncedAllAtTimestampStrategy
- Defined in:
- lib/synced/strategies/synced_all_at_timestamp_strategy.rb
Overview
This is a strategy for UpdatedSince defining how to store and update synced timestamps. It uses synced_all_at column on model to store update time.
Instance Attribute Summary collapse
-
#relation_scope ⇒ Object
readonly
Returns the value of attribute relation_scope.
Instance Method Summary collapse
-
#initialize(relation_scope:, **_options) ⇒ SyncedAllAtTimestampStrategy
constructor
A new instance of SyncedAllAtTimestampStrategy.
- #last_synced_at ⇒ Object
- #reset ⇒ Object
- #update(timestamp) ⇒ Object
Constructor Details
#initialize(relation_scope:, **_options) ⇒ SyncedAllAtTimestampStrategy
Returns a new instance of SyncedAllAtTimestampStrategy.
8 9 10 |
# File 'lib/synced/strategies/synced_all_at_timestamp_strategy.rb', line 8 def initialize(relation_scope:, **) @relation_scope = relation_scope end |
Instance Attribute Details
#relation_scope ⇒ Object (readonly)
Returns the value of attribute relation_scope.
6 7 8 |
# File 'lib/synced/strategies/synced_all_at_timestamp_strategy.rb', line 6 def relation_scope @relation_scope end |
Instance Method Details
#last_synced_at ⇒ Object
12 13 14 |
# File 'lib/synced/strategies/synced_all_at_timestamp_strategy.rb', line 12 def last_synced_at relation_scope.minimum(synced_all_at_key) end |
#reset ⇒ Object
20 21 22 |
# File 'lib/synced/strategies/synced_all_at_timestamp_strategy.rb', line 20 def reset relation_scope.update_all(synced_all_at_key => nil) end |
#update(timestamp) ⇒ Object
16 17 18 |
# File 'lib/synced/strategies/synced_all_at_timestamp_strategy.rb', line 16 def update() relation_scope.update_all(synced_all_at_key => ) end |