lib/ledger_sync/domains/operation.rb in ledger_sync-domains-1.1.3 vs lib/ledger_sync/domains/operation.rb in ledger_sync-domains-1.1.4
- old
+ new
@@ -58,12 +58,13 @@
end
end
attr_reader :params, :result
- def initialize(domain:, **params)
+ def initialize(domain:, serializer: nil, **params)
@domain = domain
+ @serializer = serializer
@params = params
@result = nil
end
def perform # rubocop:disable Metrics/MethodLength
@@ -110,10 +111,10 @@
def serialize(resource:)
serializer_for(resource: resource).serialize(resource: resource)
end
def serializer_for(resource:)
- serializer_class_for(resource: resource).new
+ @serializer || serializer_class_for(resource: resource).new
end
def serializer_class_for(resource:)
Object.const_get(
[