Method: CouchRest::Attributes#initialize
- Defined in:
- lib/couchrest/attributes.rb
#initialize(attrs = nil) ⇒ Object
Initialize a new CouchRest Document and prepare a hidden attributes hash.
When inherting a Document, it is essential that the super method is called before you own changes to ensure that the attributes hash has been initialized before you attempt to use it.
22 23 24 |
# File 'lib/couchrest/attributes.rb', line 22 def initialize(attrs = nil) attrs.each{|k,v| self[k] = v} unless attrs.nil? end |