Class: CouchbaseOrm::Document
- Inherits:
-
Object
- Object
- CouchbaseOrm::Document
show all
- Extended by:
- Enum
- Includes:
- ActiveModel::Attributes, ActiveModel::Dirty, ActiveModel::Model, ActiveModel::Serializers::JSON, ActiveModel::Validations, ActiveModel::Validations::Callbacks, ActiveRecord::Core, ActiveRecordCompat, Embedded, Encrypt
- Defined in:
- lib/couchbase-orm/base.rb
Defined Under Namespace
Classes: Metadata, MismatchTypeError
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Encrypt
#decode_encrypted_attributes, #encode_encrypted_attributes
#_has_attribute?, #_write_attribute, #attribute_for_inspect, #attribute_names, #attribute_present?, #format_for_inspect, #has_attribute?, #primary_key_values_present?
Constructor Details
#initialize(attributes = nil) ⇒ Document
Returns a new instance of Document.
203
204
205
206
207
208
|
# File 'lib/couchbase-orm/base.rb', line 203
def initialize(attributes = nil)
CouchbaseOrm.logger.debug { "Initialize model #{self.class} with #{attributes&.to_s&.truncate(200)}" }
@__metadata__ = Metadata.new
super(attributes)
end
|
Class Method Details
.descendants ⇒ Object
168
169
170
|
# File 'lib/couchbase-orm/base.rb', line 168
def descendants
@__descendants ||= [] end
|
.inherited(subclass) ⇒ Object
172
173
174
175
|
# File 'lib/couchbase-orm/base.rb', line 172
def inherited(subclass)
super
descendants << subclass
end
|
Instance Method Details
#[](key) ⇒ Object
214
215
216
|
# File 'lib/couchbase-orm/base.rb', line 214
def [](key)
send(key)
end
|
#[]=(key, value) ⇒ Object
218
219
220
|
# File 'lib/couchbase-orm/base.rb', line 218
def []=(key, value)
send(:"#{key}=", value)
end
|
#attributes ⇒ Object
210
211
212
|
# File 'lib/couchbase-orm/base.rb', line 210
def attributes
super.with_indifferent_access
end
|