Sha256: 04398bc137e4a1db71b99fe27c80ee54a69103e78dee741141d9871a0b30865b

Contents?: true

Size: 659 Bytes

Versions: 18

Compression:

Stored size: 659 Bytes

Contents

# frozen_string_literal: true

module LedgerSync
  module Util
    class ResourceConverter
      module Type
        class ResourceConverterType < LedgerSync::Type::Value
          attr_reader :resource_converter

          def initialize(args = {})
            @resource_converter = args.fetch(:resource_converter)

            super()
          end

          def cast_value(args = {})
            destination = args.fetch(:destination)
            source      = args.fetch(:value)

            return if source.nil?

            resource_converter.new.convert(destination: destination, source: source)
          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
ledger_sync-2.6.0 lib/ledger_sync/util/resource_converter/type/resource_converter_type.rb
ledger_sync-2.5.0 lib/ledger_sync/util/resource_converter/type/resource_converter_type.rb
ledger_sync-2.4.4 lib/ledger_sync/util/resource_converter/type/resource_converter_type.rb
ledger_sync-2.3.1 lib/ledger_sync/util/resource_converter/type/resource_converter_type.rb
ledger_sync-2.2.3 lib/ledger_sync/util/resource_converter/type/resource_converter_type.rb
ledger_sync-2.2.1 lib/ledger_sync/util/resource_converter/type/resource_converter_type.rb
ledger_sync-2.2.0 lib/ledger_sync/util/resource_converter/type/resource_converter_type.rb
ledger_sync-2.0.2 lib/ledger_sync/util/resource_converter/type/resource_converter_type.rb
ledger_sync-2.0.1 lib/ledger_sync/util/resource_converter/type/resource_converter_type.rb
ledger_sync-2.0.0 lib/ledger_sync/util/resource_converter/type/resource_converter_type.rb
ledger_sync-2.0.0.pre.1 lib/ledger_sync/util/resource_converter/type/resource_converter_type.rb
ledger_sync-1.8.1 lib/ledger_sync/util/resource_converter/type/resource_converter_type.rb
ledger_sync-1.8.0 lib/ledger_sync/util/resource_converter/type/resource_converter_type.rb
ledger_sync-1.7.0 lib/ledger_sync/util/resource_converter/type/resource_converter_type.rb
ledger_sync-1.6.0 lib/ledger_sync/util/resource_converter/type/resource_converter_type.rb
ledger_sync-1.5.2 lib/ledger_sync/util/resource_converter/type/resource_converter_type.rb
ledger_sync-1.5.1 lib/ledger_sync/util/resource_converter/type/resource_converter_type.rb
ledger_sync-1.5.0 lib/ledger_sync/util/resource_converter/type/resource_converter_type.rb