Using Classes instead of strings for typecasting and removing redundant comparisons

This commit is contained in:
Sam Lown 2010-03-30 19:06:24 +00:00
parent e922b81ccc
commit 64d68ecc1a
2 changed files with 12 additions and 17 deletions

View file

@ -57,6 +57,7 @@ module CouchRest
associate_casted_to_parent(value, assigned)
value
end
# only cast arrays of more complex objects (i.e. not strings)
self[key] = klass != String ? CastedArray.new(arr) : arr
self[key].casted_by = self if self[key].respond_to?(:casted_by)
else