Class: ActiveRecord::ConnectionAdapters::PostgreSQL::OID::LegacyPoint
- Inherits:
-
Type::Value
- Object
- ActiveRecord::ConnectionAdapters::PostgreSQL::OID::LegacyPoint
- Includes:
- ActiveModel::Type::Helpers::Mutable
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb
Overview
:nodoc:
Instance Method Summary collapse
Methods included from ActiveModel::Type::Helpers::Mutable
Instance Method Details
#cast(value) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb', line 14 def cast(value) case value when ::String if value.start_with?("(") && value.end_with?(")") value = value[1...-1] end cast(value.split(",")) when ::Array value.map { |v| Float(v) } else value end end |
#serialize(value) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb', line 28 def serialize(value) if value.is_a?(::Array) "(#{number_for_point(value[0])},#{number_for_point(value[1])})" else super end end |
#type ⇒ Object
10 11 12 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb', line 10 def type :point end |