Class: TableSync::Publishing::Single
- Inherits:
-
Object
- Object
- TableSync::Publishing::Single
- Includes:
- Memery
- Defined in:
- lib/table_sync/publishing/single.rb
Instance Attribute Summary collapse
-
#custom_version ⇒ Object
Returns the value of attribute custom_version.
-
#debounce_time ⇒ Object
Returns the value of attribute debounce_time.
-
#event ⇒ Object
Returns the value of attribute event.
-
#object_class ⇒ Object
Returns the value of attribute object_class.
-
#original_attributes ⇒ Object
Returns the value of attribute original_attributes.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Single
constructor
A new instance of Single.
-
#publish_later ⇒ Object
expect job to have perform_at method debounce destroyed event because otherwise update event could be sent after destroy.
- #publish_now ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ Single
Returns a new instance of Single.
12 13 14 15 16 17 18 19 20 |
# File 'lib/table_sync/publishing/single.rb', line 12 def initialize(attrs = {}) attrs = attrs.with_indifferent_access self.object_class = attrs[:object_class] self.original_attributes = attrs[:original_attributes] self.debounce_time = attrs[:debounce_time] self.custom_version = attrs[:custom_version] self.event = attrs.fetch(:event, :update) end |
Instance Attribute Details
#custom_version ⇒ Object
Returns the value of attribute custom_version.
6 7 8 |
# File 'lib/table_sync/publishing/single.rb', line 6 def custom_version @custom_version end |
#debounce_time ⇒ Object
Returns the value of attribute debounce_time.
6 7 8 |
# File 'lib/table_sync/publishing/single.rb', line 6 def debounce_time @debounce_time end |
#event ⇒ Object
Returns the value of attribute event.
6 7 8 |
# File 'lib/table_sync/publishing/single.rb', line 6 def event @event end |
#object_class ⇒ Object
Returns the value of attribute object_class.
6 7 8 |
# File 'lib/table_sync/publishing/single.rb', line 6 def object_class @object_class end |
#original_attributes ⇒ Object
Returns the value of attribute original_attributes.
6 7 8 |
# File 'lib/table_sync/publishing/single.rb', line 6 def original_attributes @original_attributes end |
Instance Method Details
#publish_later ⇒ Object
expect job to have perform_at method debounce destroyed event because otherwise update event could be sent after destroy
25 26 27 28 29 30 31 |
# File 'lib/table_sync/publishing/single.rb', line 25 def publish_later return if debounce.skip? job.perform_at(job_attributes) debounce.cache_next_sync_time end |
#publish_now ⇒ Object
33 34 35 |
# File 'lib/table_sync/publishing/single.rb', line 33 def publish_now .publish unless .empty? end |