Class: Torque::PostgreSQL::Adapter::OID::Lquery
- Inherits:
-
ActiveModel::Type::Value
- Object
- ActiveModel::Type::Value
- Torque::PostgreSQL::Adapter::OID::Lquery
- Defined in:
- lib/torque/postgresql/adapter/oid/lquery.rb
Instance Method Summary collapse
-
#==(other) ⇒ Object
(also: #eql?)
Types resolved through the type map are deduplicated and frozen, so they need to be comparable.
- #cast(value) ⇒ Object
- #changed_in_place?(raw_old_value, new_value) ⇒ Boolean
- #deserialize(value) ⇒ Object
- #hash ⇒ Object
- #serialize(value) ⇒ Object
- #type ⇒ Object
- #type_cast_for_schema(value) ⇒ Object
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
Types resolved through the type map are deduplicated and frozen, so they need to be comparable
40 41 42 |
# File 'lib/torque/postgresql/adapter/oid/lquery.rb', line 40 def ==(other) other.is_a?(self.class) end |
#cast(value) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/torque/postgresql/adapter/oid/lquery.rb', line 13 def cast(value) return if value.blank? return value if value.is_a?(LQuery) LQuery.new(value) end |
#changed_in_place?(raw_old_value, new_value) ⇒ Boolean
34 35 36 |
# File 'lib/torque/postgresql/adapter/oid/lquery.rb', line 34 def changed_in_place?(raw_old_value, new_value) raw_old_value != serialize(new_value) end |
#deserialize(value) ⇒ Object
20 21 22 23 24 |
# File 'lib/torque/postgresql/adapter/oid/lquery.rb', line 20 def deserialize(value) return if value.nil? LQuery.load(value) end |
#hash ⇒ Object
45 46 47 |
# File 'lib/torque/postgresql/adapter/oid/lquery.rb', line 45 def hash self.class.hash end |
#serialize(value) ⇒ Object
26 27 28 |
# File 'lib/torque/postgresql/adapter/oid/lquery.rb', line 26 def serialize(value) cast(value)&.to_s end |
#type ⇒ Object
9 10 11 |
# File 'lib/torque/postgresql/adapter/oid/lquery.rb', line 9 def type :lquery end |
#type_cast_for_schema(value) ⇒ Object
30 31 32 |
# File 'lib/torque/postgresql/adapter/oid/lquery.rb', line 30 def type_cast_for_schema(value) cast(value).to_s.inspect end |