Sha256: 615add76a4d4eb8b38de99e3c445ec8266c89704047f294c098dc1c38eeea657

Contents?: true

Size: 575 Bytes

Versions: 6

Compression:

Stored size: 575 Bytes

Contents

# frozen_string_literal: true

module LedgerSync
  module Type
    class ID < 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?(::String)
      end

      def type
        :id
      end

      def valid_classes
        [::String, ::Symbol, ::Integer]
      end

      private

      def cast_value(value)
        case value
        when ::String then ::String.new(value)
        else value.to_s
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ledger_sync-1.3.4 lib/ledger_sync/type/id.rb
ledger_sync-1.3.3 lib/ledger_sync/type/id.rb
ledger_sync-1.3.2 lib/ledger_sync/type/id.rb
ledger_sync-1.3.1 lib/ledger_sync/type/id.rb
ledger_sync-1.1.3 lib/ledger_sync/type/id.rb
ledger_sync-1.1.2 lib/ledger_sync/type/id.rb