Sha256: 2ad1c9d5ff78e47b26f7056e4ec5ddf73b692072089029986af096b9eac88ddb

Contents?: true

Size: 585 Bytes

Versions: 35

Compression:

Stored size: 585 Bytes

Contents

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

35 entries across 35 versions & 4 rubygems

Version Path
activerecord-5.0.7.2 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.0.7.1 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.0.7 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.0.6 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.0.6.rc1 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.0.5 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.0.5.rc2 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.0.5.rc1 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.0.4 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.0.4.rc1 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.0.3 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/activerecord-5.0.2/lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.0.2 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
activerecord-5.0.2.rc1 lib/active_record/connection_adapters/postgresql/oid/date_time.rb
autocompl-0.2.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/connection_adapters/postgresql/oid/date_time.rb
autocompl-0.2.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/connection_adapters/postgresql/oid/date_time.rb
autocompl-0.2.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/connection_adapters/postgresql/oid/date_time.rb
autocompl-0.1.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/connection_adapters/postgresql/oid/date_time.rb
autocompl-0.1.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/connection_adapters/postgresql/oid/date_time.rb
autocompl-0.1.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.1/lib/active_record/connection_adapters/postgresql/oid/date_time.rb