Class: CouchbaseOrm::NestedDocument
- Defined in:
- lib/couchbase-orm/base.rb
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
-
#initialize(*args, **kwargs) ⇒ NestedDocument
constructor
A new instance of NestedDocument.
Methods inherited from Document
Methods included from Encrypt
#as_json, #decode_encrypted_attributes, #encode_encrypted_attributes, #to_json
Methods included from ActiveRecordCompat
#_has_attribute?, #_write_attribute, #attribute_for_inspect, #attribute_names, #attribute_present?, #format_for_inspect, #has_attribute?, #read_attribute
Constructor Details
#initialize(*args, **kwargs) ⇒ NestedDocument
Returns a new instance of NestedDocument.
216 217 218 219 220 221 |
# File 'lib/couchbase-orm/base.rb', line 216 def initialize(*args, **kwargs) super return unless respond_to?(:id) && id.nil? assign_attributes(id: SecureRandom.hex) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
223 224 225 226 |
# File 'lib/couchbase-orm/base.rb', line 223 def ==(other) other.instance_of?(self.class) && ((respond_to?(:id) && !id.nil? && other.id == id) || other.serialized_attributes == serialized_attributes) end |