Class: Torque::PostgreSQL::Adapter::OID::StructSet
- Inherits:
-
ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Array
- Object
- ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Array
- Torque::PostgreSQL::Adapter::OID::StructSet
- Defined in:
- lib/torque/postgresql/adapter/oid/struct_set.rb
Instance Method Summary collapse
- #blank_document ⇒ Object
- #changed_in_place?(raw_old_value, new_value) ⇒ Boolean
- #deserialize(value) ⇒ Object
- #empty?(value) ⇒ Boolean
- #serialize(value) ⇒ Object
- #without_backfill ⇒ Object
Instance Method Details
#blank_document ⇒ Object
31 32 33 |
# File 'lib/torque/postgresql/adapter/oid/struct_set.rb', line 31 def blank_document [] end |
#changed_in_place?(raw_old_value, new_value) ⇒ Boolean
17 18 19 20 |
# File 'lib/torque/postgresql/adapter/oid/struct_set.rb', line 17 def changed_in_place?(raw_old_value, new_value) Struct.state(without_backfill.deserialize(raw_old_value)) != Struct.state(new_value) end |
#deserialize(value) ⇒ Object
8 9 10 |
# File 'lib/torque/postgresql/adapter/oid/struct_set.rb', line 8 def deserialize(value) value.nil? ? [] : super end |
#empty?(value) ⇒ Boolean
27 28 29 |
# File 'lib/torque/postgresql/adapter/oid/struct_set.rb', line 27 def empty?(value) value.is_a?(::Array) ? value.empty? : subtype.empty?(value) end |
#serialize(value) ⇒ Object
12 13 14 15 |
# File 'lib/torque/postgresql/adapter/oid/struct_set.rb', line 12 def serialize(value) return if value.is_a?(::Array) && value.empty? super end |
#without_backfill ⇒ Object
22 23 24 25 |
# File 'lib/torque/postgresql/adapter/oid/struct_set.rb', line 22 def without_backfill return self if subtype.backfill.nil? @without_backfill ||= self.class.new(subtype.without_backfill, delimiter) end |