Sha256: 47e6551382ac62b7836867886f2f3f55462a4aee0eeb3e05e88c1c2d4fe7f40d

Contents?: true

Size: 616 Bytes

Versions: 60

Compression:

Stored size: 616 Bytes

Contents

# frozen_string_literal: true

module ActiveRecord
  module ConnectionAdapters
    module PostgreSQL
      module OID # :nodoc:
        class DateTime < Type::DateTime # :nodoc:
          def cast_value(value)
            case value
            when "infinity" then ::Float::INFINITY
            when "-infinity" then -::Float::INFINITY
            when / BC$/
              astronomical_year = format("%04d", -value[/^\d+/].to_i + 1)
              super(value.sub(/ BC$/, "").sub(/^\d+/, astronomical_year))
            else
              super
            end
          end
        end
      end
    end
  end
end

Version data entries

60 entries across 60 versions & 7 rubygems

Version Path
activerecord-5.2.8.1 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.2.8 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.2.7.1 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.2.7 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.2.6.3 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.2.6.2 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.2.6.1 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.2.6 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-6.0.3.7 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.2.4.6 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-6.0.3.6 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.2.5 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-6.0.3.5 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.2.4.5 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-6.0.3.4 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.2.4.4 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-6.0.3.3 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-6.0.3.2 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-6.0.3.1 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.2.4.3 lib/active_record/connection_adapters/postgresql/oid/date_time.rb