lib/table_sync/publishing/data/raw.rb in table_sync-6.0.4 vs lib/table_sync/publishing/data/raw.rb in table_sync-6.1.0
- old
+ new
@@ -1,24 +1,28 @@
# frozen_string_literal: true
module TableSync::Publishing::Data
class Raw
- attr_reader :object_class, :attributes_for_sync, :event
+ attr_reader :model_name, :attributes_for_sync, :event
- def initialize(object_class:, attributes_for_sync:, event:)
- @object_class = object_class
+ def initialize(model_name:, attributes_for_sync:, event:)
+ @model_name = model_name
@attributes_for_sync = attributes_for_sync
@event = TableSync::Event.new(event)
end
def construct
{
- model: object_class,
- attributes: attributes_for_sync,
+ model: model_name,
+ attributes: wrapped_attributes_for_sync,
version: version,
event: event.resolve,
metadata: event.metadata,
}
+ end
+
+ def wrapped_attributes_for_sync
+ attributes_for_sync.is_a?(Array) ? attributes_for_sync : [attributes_for_sync]
end
def version
Time.current.to_f
end