Module: MiniMongo::Core
- Included in:
- Base
- Defined in:
- lib/mini_mongo/core.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
(also: #to_hash)
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
- #initialize(attributes = {}) ⇒ Object
- #inspect ⇒ Object
-
#to_a ⇒ Object
Return an array with this
Documentonly in it.
Instance Attribute Details
#attributes ⇒ Object (readonly) Also known as: to_hash
Returns the value of attribute attributes.
4 5 6 |
# File 'lib/mini_mongo/core.rb', line 4 def attributes @attributes end |
Instance Method Details
#initialize(attributes = {}) ⇒ Object
8 9 10 11 |
# File 'lib/mini_mongo/core.rb', line 8 def initialize(attributes = {}) @attributes = {} assign_attributes(attributes.dup) end |
#inspect ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/mini_mongo/core.rb', line 23 def inspect inspection = if attributes attributes.collect { |key, value| "#{key}: #{value_for_inspect(value)}" }.compact.join(", ") else "not initialized" end "#<#{self.class} #{inspection}>" end |
#to_a ⇒ Object
Return an array with this Document only in it.
18 19 20 |
# File 'lib/mini_mongo/core.rb', line 18 def to_a attributes.to_a end |