Class: CouchbaseOrm::Document
- Inherits:
-
Object
- Object
- CouchbaseOrm::Document
- 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
Direct Known Subclasses
Defined Under Namespace
Classes: Metadata, MismatchTypeError
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #attributes ⇒ Object
-
#initialize(attributes = nil) ⇒ Document
constructor
A new instance of 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?
Constructor Details
#initialize(attributes = nil) ⇒ Document
Returns a new instance of Document.
161 162 163 164 165 166 |
# File 'lib/couchbase-orm/base.rb', line 161 def initialize(attributes = nil) CouchbaseOrm.logger.debug { "Initialize model #{self.class} with #{attributes&.to_s&.truncate(200)}" } @__metadata__ = Metadata.new super(attributes) end |
Instance Method Details
#[](key) ⇒ Object
172 173 174 |
# File 'lib/couchbase-orm/base.rb', line 172 def [](key) send(key) end |
#[]=(key, value) ⇒ Object
176 177 178 |
# File 'lib/couchbase-orm/base.rb', line 176 def []=(key, value) send(:"#{key}=", value) end |
#attributes ⇒ Object
168 169 170 |
# File 'lib/couchbase-orm/base.rb', line 168 def attributes super.with_indifferent_access end |