Sha256: f86d8847cfa264e9a18a31668378234fd9ea9935eff2a4827a05e618fba4b962

Contents?: true

Size: 594 Bytes

Versions: 30

Compression:

Stored size: 594 Bytes

Contents

# frozen_string_literal: true

module ActiveRecord
  module ConnectionAdapters
    module CipherStashPG
      module OID # :nodoc:
        class Date < Type::Date # :nodoc:
          def cast_value(value)
            case value
            when "infinity" then ::Float::INFINITY
            when "-infinity" then -::Float::INFINITY
            when / BC$/
              value = value.sub(/^\d+/) { |year| format("%04d", -year.to_i + 1) }
              super(value.delete_suffix!(" BC"))
            else
              super
            end
          end
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
activerecord-cipherstash-pg-adapter-0.7.4 lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/date.rb
activerecord-cipherstash-pg-adapter-0.7.3 lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/date.rb
activerecord-cipherstash-pg-adapter-0.7.2 lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/date.rb
activerecord-cipherstash-pg-adapter-0.7.1 lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/date.rb
activerecord-cipherstash-pg-adapter-0.7.0 lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/date.rb
activerecord-cipherstash-pg-adapter-0.6.1 lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/date.rb
activerecord-cipherstash-pg-adapter-0.6.0 lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/date.rb
activerecord-cipherstash-pg-adapter-0.5.0 lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/date.rb
activerecord-cipherstash-pg-adapter-0.4.0 lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/date.rb
activerecord-cipherstash-pg-adapter-0.3.0 lib/active_record/connection_adapters/6.1/cipherstash_pg/oid/date.rb