lib/couchrest/more/property.rb in peterpunk-couchrest-0.33 vs lib/couchrest/more/property.rb in peterpunk-couchrest-0.34.1

- old
+ new

@@ -36,5 +36,24 @@ @options = options end end end + +class CastedArray < Array + attr_accessor :casted_by + + def << obj + obj.casted_by = self.casted_by if obj.respond_to?(:casted_by) + super(obj) + end + + def push(obj) + obj.casted_by = self.casted_by if obj.respond_to?(:casted_by) + super(obj) + end + + def []= index, obj + obj.casted_by = self.casted_by if obj.respond_to?(:casted_by) + super(index, obj) + end +end \ No newline at end of file