lib/rico/object.rb in rico-0.2.0 vs lib/rico/object.rb in rico-0.3.0
- old
+ new
@@ -1,31 +1,29 @@
module Rico
module Object
extend Forwardable
- def_delegators :riak_object, :conflict?, :delete, :store
+ def_delegators :riak_object, :conflict?, :content_type, :content_type=, :data, :delete, :store, :raw_data
+ attr_accessor :bucket, :key
+
# 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
#
# Returns nothing
- def initialize(bucket, key)
+ def initialize(bucket, key, options={})
@bucket, @key = bucket, key
+ options.each {|k,v| send("#{k}=", v)}
end
- def data
- @data ||= riak_object.data
- end
-
# Sets a new value on the object and stores it
#
# value - new value to set
#
# Returns the result of the store operation
def mutate(value)
- @data = value
riak_object.data = value
store
end
# Determine whether an object exists or not