Simplifying and moving CastedArray into own file

This commit is contained in:
Sam Lown 2010-03-31 08:25:33 +00:00
parent 1b019fa3fe
commit f196aacecc
4 changed files with 35 additions and 25 deletions

View file

@ -1,5 +1,6 @@
require 'time'
require File.join(File.dirname(__FILE__), '..', 'more', 'property')
require File.join(File.dirname(__FILE__), '..', 'more', 'casted_array')
require File.join(File.dirname(__FILE__), '..', 'more', 'typecast')
module CouchRest
@ -58,7 +59,7 @@ module CouchRest
value
end
# allow casted_by calls to be passed up chain by wrapping in CastedArray
self[key] = klass != String ? CastedArray.new(arr) : arr
self[key] = klass != String ? ::CouchRest::CastedArray.new(arr) : arr
self[key].casted_by = self if self[key].respond_to?(:casted_by)
else
self[key] = typecast_value(self[key], property.type, property.init_method)