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-6.0.3 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-6.0.3.rc1 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-6.0.2.2 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.2.4.2 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
argon-1.3.1 vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.2.1/lib/active_record/connection_adapters/postgresql/oid/date_time.rb
symbolic_enum-1.1.5 vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.2.1/lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-6.0.2.1 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.2.4.1 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-6.0.2 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-6.0.2.rc2 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.2.4 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-6.0.2.rc1 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.2.4.rc1 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-6.0.1 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/activerecord-6.0.0/lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-6.0.1.rc1 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/activerecord-6.0.0/lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-6.0.0 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
spiral_form-0.1.1 vendor/bundle/gems/activerecord-5.2.3/lib/active_record/connection_adapters/postgresql/oid/date_time.rb
spiral_form-0.1.0 vendor/bundle/gems/activerecord-5.2.3/lib/active_record/connection_adapters/postgresql/oid/date_time.rb