Sha256: e2f0b2b2bda31365191baaaf37b8ac13c3c890d46a017c18e30edfafdd3f7b60

Contents?: true

Size: 628 Bytes

Versions: 40

Compression:

Stored size: 628 Bytes

Contents

require File.join(File.dirname(__FILE__), '..', 'mixins', 'properties')

module CouchRest
  module CastedModel
    
    def self.included(base)
      base.send(:include, CouchRest::Mixins::Properties)
      base.send(:attr_accessor, :casted_by)
    end
    
    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
    
    def []= key, value
      super(key.to_s, value)
    end
    
    def [] key
      super(key.to_s)
    end
  end
end

Version data entries

40 entries across 40 versions & 15 rubygems

Version Path
brianmario-couchrest-0.23 lib/couchrest/more/casted_model.rb
gbuesing-couchrest-0.23 lib/couchrest/more/casted_model.rb
glasner-couchrest-0.2.2 lib/couchrest/more/casted_model.rb
gohanlonllc-couchrest-0.2.3.1 lib/couchrest/more/casted_model.rb
halfninja-couchrest-0.23.2 lib/couchrest/more/casted_model.rb
halfninja-couchrest-0.23.3 lib/couchrest/more/casted_model.rb
jchris-couchrest-0.16 lib/couchrest/more/casted_model.rb
jchris-couchrest-0.17.0 lib/couchrest/more/casted_model.rb
jchris-couchrest-0.2.1 lib/couchrest/more/casted_model.rb
jchris-couchrest-0.2.2 lib/couchrest/more/casted_model.rb
jchris-couchrest-0.2 lib/couchrest/more/casted_model.rb
jchris-couchrest-0.22 lib/couchrest/more/casted_model.rb
jchris-couchrest-0.23 lib/couchrest/more/casted_model.rb
jkestr-couchrest-0.23 lib/couchrest/more/casted_model.rb
jrun-couchrest-0.17.1 lib/couchrest/more/casted_model.rb
jrun-couchrest-0.2.1.1 lib/couchrest/more/casted_model.rb
jrun-couchrest-0.2.1 lib/couchrest/more/casted_model.rb
mattetti-couchrest-0.13.1 lib/couchrest/more/casted_model.rb
mattetti-couchrest-0.13.2 lib/couchrest/more/casted_model.rb
mattetti-couchrest-0.13.3 lib/couchrest/more/casted_model.rb