Module: CouchRest::CastedModel

Defined in:
lib/couchrest/more/casted_model.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
# File 'lib/couchrest/more/casted_model.rb', line 6

def self.included(base)
  base.send(:include, CouchRest::Mixins::Properties)
  base.send(:attr_accessor, :casted_by)
end

Instance Method Details

#[](key) ⇒ Object



24
25
26
# File 'lib/couchrest/more/casted_model.rb', line 24

def [] key
  super(key.to_s)
end

#[]=(key, value) ⇒ Object



20
21
22
# File 'lib/couchrest/more/casted_model.rb', line 20

def []= key, value
  super(key.to_s, value)
end

#initialize(keys = {}) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/couchrest/more/casted_model.rb', line 11

def initialize(keys={})
  super
  keys.each do |k,v|
    self[k.to_s] = v
  end if keys
  apply_defaults # defined in CouchRest::Mixins::Properties
  # cast_keys      # defined in CouchRest::Mixins::Properties
end