Sha256: ebd3278fe0cf89769ce329f8bc367b1c6f2a8141892f8ac7d0790688914e66be

Contents?: true

Size: 614 Bytes

Versions: 22

Compression:

Stored size: 614 Bytes

Contents

# frozen_string_literal: true

require_relative 'value'

module LedgerSync
  module Type
    class Hash < Value # :nodoc:
      include ValueMixin

      def cast?
        true
      end

      def changed_in_place?(raw_old_value, new_value)
        raw_old_value != new_value if new_value.is_a?(::Hash)
      end

      def type
        :id
      end

      def valid_classes
        [::Hash]
      end

      private

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

        case value
        when ::Hash then value.clone
        else { value: value }
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

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