Sha256: fd8c0bb4b0eafe2067eed77e290075d09aabc8e185472d71cdd83b1777a2fd6c

Contents?: true

Size: 446 Bytes

Versions: 4

Compression:

Stored size: 446 Bytes

Contents

# frozen_string_literal: true

module LedgerSync
  module Serialization
    module Type
      class FormatDateType < LedgerSync::Type::Value
        attr_reader :format

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

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

          return if value.nil?

          value.to_datetime.strftime(format)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ledger_sync-1.4.4 lib/ledger_sync/serialization/type/format_date_type.rb
ledger_sync-1.4.2 lib/ledger_sync/serialization/type/format_date_type.rb
ledger_sync-1.4.1 lib/ledger_sync/serialization/type/format_date_type.rb
ledger_sync-1.4.0 lib/ledger_sync/serialization/type/format_date_type.rb