diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-06-02 08:58:12 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-06-02 08:58:12 +0200 |
commit | f17fa8ef6f2abffeea5398cc450172c0975cad27 (patch) | |
tree | d6ec8cd97ef8dddf52472a5251d1fc90cfe0ac13 /activerecord/lib/active_record/connection_adapters/postgresql/cast.rb | |
parent | 4c66ab2b2181a2c1d7163c24ce8aec0dbb3bef7b (diff) | |
download | rails-f17fa8ef6f2abffeea5398cc450172c0975cad27.tar.gz rails-f17fa8ef6f2abffeea5398cc450172c0975cad27.tar.bz2 rails-f17fa8ef6f2abffeea5398cc450172c0975cad27.zip |
pg, inline casting methods into `OID::Type` objects.
This inlines casting for the most obvious types. The rest will
follow eventually. I need to put some tests in place, to make sure
that the inlining is not causing regressions.
/cc @sgrif
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql/cast.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/cast.rb | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/cast.rb b/activerecord/lib/active_record/connection_adapters/postgresql/cast.rb index f7bad20f00..971f5eed7e 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/cast.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/cast.rb @@ -6,15 +6,6 @@ module ActiveRecord "(#{point[0]},#{point[1]})" end - def string_to_bit(value) # :nodoc: - case value - when /^0x/i - value[2..-1].hex.to_s(2) # Hexadecimal notation - else - value # Bit-string notation - end - end - def hstore_to_string(object, array_member = false) # :nodoc: if Hash === object string = object.map { |k, v| "#{escape_hstore(k)}=>#{escape_hstore(v)}" }.join(',') @@ -76,28 +67,6 @@ module ActiveRecord end end - def string_to_cidr(string) # :nodoc: - if string.nil? - nil - elsif String === string - begin - IPAddr.new(string) - rescue ArgumentError - nil - end - else - string - end - end - - def cidr_to_string(object) # :nodoc: - if IPAddr === object - "#{object.to_s}/#{object.instance_variable_get(:@mask_addr).to_s(2).count('1')}" - else - object - end - end - def string_to_array(string, oid) # :nodoc: parse_pg_array(string).map {|val| type_cast_array(oid, val)} end |