lib/yao/resources/base.rb in yao-0.13.1 vs lib/yao/resources/base.rb in yao-0.13.2
- old
+ new
@@ -5,11 +5,11 @@
class Base
def self.friendly_attributes(*names)
names.map(&:to_s).each do |name|
define_method(name) do
if !@data.key?(name) && id
- @data = self.class.get(id)
+ @data = self.class.get(id).to_hash
end
self[name]
end
end
end
@@ -47,9 +47,13 @@
@data[name]
end
def []=(name, value)
@data[name] = value
+ end
+
+ def to_hash
+ @data
end
def id
self["id"]
end