lib/rico/object.rb in rico-0.0.1 vs lib/rico/object.rb in rico-0.1.0
- old
+ new
@@ -1,10 +1,10 @@
module Rico
module Object
extend Forwardable
- def_delegators :riak_object, :store, :delete
+ def_delegators :riak_object, :conflict?, :delete, :store
# Initialize an object with a bucket and key
#
# bucket - the name of the bucket (not prefixed by a namespace)
# key - the name of the key
@@ -24,20 +24,25 @@
#
# Returns the result of the store operation
def mutate(value)
@data = value
riak_object.data = value
- riak_object.store
+ store
end
# Determine whether an object exists or not
#
# Returns true or false
def exists?
Rico.bucket(@bucket).exists? @key
end
protected
+
+ def type_key
+ name = self.class.name.split("::").last
+ Rico::TYPES[name]
+ end
def riak_object
@riak_object ||= Rico.bucket(@bucket).get_or_new @key
end
end