Sha256: ed67e291fc4db8bb6410d813a9994226d8e27b8d58a63e93afd707c1eb785043

Contents?: true

Size: 677 Bytes

Versions: 16

Compression:

Stored size: 677 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={})
      raise StandardError unless self.is_a? Hash
      apply_defaults # defined in CouchRest::Mixins::Properties
      super()
      keys.each do |k,v|
        self[k.to_s] = v
      end if keys
      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

16 entries across 16 versions & 5 rubygems

Version Path
mattetti-couchrest-0.28 lib/couchrest/more/casted_model.rb
mattetti-couchrest-0.29 lib/couchrest/more/casted_model.rb
mattetti-couchrest-0.30 lib/couchrest/more/casted_model.rb
mattetti-couchrest-0.31 lib/couchrest/more/casted_model.rb
mattetti-couchrest-0.32 lib/couchrest/more/casted_model.rb
norr-couchrest-0.30.1 lib/couchrest/more/casted_model.rb
norr-couchrest-0.30.2 lib/couchrest/more/casted_model.rb
norr-couchrest-0.30.3 lib/couchrest/more/casted_model.rb
norr-couchrest-0.30.4 lib/couchrest/more/casted_model.rb
norr-couchrest-0.30 lib/couchrest/more/casted_model.rb
oz-couchrest-0.29 lib/couchrest/more/casted_model.rb
will-couchrest-0.32.1 lib/couchrest/more/casted_model.rb
couchrest-0.30 lib/couchrest/more/casted_model.rb
couchrest-0.31 lib/couchrest/more/casted_model.rb
couchrest-0.32 lib/couchrest/more/casted_model.rb
couchrest-0.28 lib/couchrest/more/casted_model.rb