lib/couchpillow/document.rb in couchpillow-0.1.1 vs lib/couchpillow/document.rb in couchpillow-0.2.0
- old
+ new
@@ -26,9 +26,19 @@
raise TypeError if @data[:_type] && @data[:_type] != self.class._type
@data[:_type] = self.class._type
end
+ def [] key
+ @data[key.to_s.to_sym]
+ end
+
+
+ def []= key, value
+ @data[key.to_s.to_sym] = value
+ end
+
+
# Map hash keys to methods
#
def method_missing m, *args, &block
ms = m.to_s
if ms.end_with?("=")