Sha256: 412a9c9f3adbd1f6baa2fc2bf89ba1d1dcb27256bdead391c39b08017b7af30c

Contents?: true

Size: 610 Bytes

Versions: 11

Compression:

Stored size: 610 Bytes

Contents

  ActiveRecord::ConnectionAdapters::PostgreSQL::OID::DateTime.class_eval do
    def cast_value(value)
      if value.is_a?(::String)
        case value
        when 'infinity' then ::Float::INFINITY
        when '-infinity' then -::Float::INFINITY
        #when / BC$/
        #  astronomical_year = format("%04d", value[/^\d+/].to_i)
        #  super(value.sub(/ BC$/, "").sub(/^\d+/, astronomical_year))
        else
          if value.end_with?(' BC')
            DateTime.parse("-#{value}"[0...-3])
          else
            super
          end
        end
      else
        value
      end
    end
  end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
activerecord-jdbc-adapter-1.3.25 lib/arjdbc/postgresql/_bc_time_cast_patch.rb
activerecord-jdbc-adapter-1.3.24 lib/arjdbc/postgresql/_bc_time_cast_patch.rb
neo-activerecord-jdbc-adapter-5.0.pre2 lib/arjdbc/postgresql/_bc_time_cast_patch.rb
activerecord-jdbc-adapter-ficoh-1.3.21-java lib/arjdbc/postgresql/_bc_time_cast_patch.rb
activerecord-jdbc-adapter-1.3.23 lib/arjdbc/postgresql/_bc_time_cast_patch.rb
activerecord-jdbc-adapter-1.3.22 lib/arjdbc/postgresql/_bc_time_cast_patch.rb
activerecord-jdbc-adapter-5.0.pre1 lib/arjdbc/postgresql/_bc_time_cast_patch.rb
activerecord-jdbc-adapter-1.3.21 lib/arjdbc/postgresql/_bc_time_cast_patch.rb
activerecord-jdbc-adapter-1.3.20 lib/arjdbc/postgresql/_bc_time_cast_patch.rb
activerecord-jdbc-adapter-1.3.19 lib/arjdbc/postgresql/_bc_time_cast_patch.rb
activerecord-jdbc-adapter-1.3.18 lib/arjdbc/postgresql/_bc_time_cast_patch.rb