Sha256: 02ed5e76e6eafe3c5d1e1b99eeb1542c8a5934a3b8c12b1e389168d66b3b3b2d

Contents?: true

Size: 601 Bytes

Versions: 1

Compression:

Stored size: 601 Bytes

Contents

# frozen_string_literal: true

require_relative 'value'

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

1 entries across 1 versions & 1 rubygems

Version Path
ledger_sync-1.3.5 lib/ledger_sync/type/id.rb