From be746b112f83d9558d725b9273a87e5342285efa Mon Sep 17 00:00:00 2001 From: Luke Bakken Date: Thu, 9 Jun 2016 09:36:05 -0700 Subject: [PATCH] Minor fixes --- lib/riak/client.rb | 2 +- lib/riak/counter.rb | 4 ++-- lib/riak/robject.rb | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/riak/client.rb b/lib/riak/client.rb index fe5d1613..46a9fcc9 100644 --- a/lib/riak/client.rb +++ b/lib/riak/client.rb @@ -261,7 +261,7 @@ def get_many(pairs) # Get an object. See Bucket#get def get_object(bucket, key, options = {}) fail ArgumentError, t('zero_length_key') if key == '' - fail ArgumentError, t('string_type', :string => key) unless key.nil? or String === key + fail ArgumentError, t('string_type', :string => key) unless String === key backend do |b| b.fetch_object(bucket, key, options) end diff --git a/lib/riak/counter.rb b/lib/riak/counter.rb index ef86039c..2b070d6f 100644 --- a/lib/riak/counter.rb +++ b/lib/riak/counter.rb @@ -14,8 +14,8 @@ class Counter # @param [Bucket] bucket the {Riak::Bucket} for this counter # @param [String] key the name of the counter def initialize(bucket, key) - fail ArgumentError, t('bucket_type', bucket: bucket.inspect) unless bucket.is_a? Bucket - fail ArgumentError, t('string_type', string: key.inspect) unless key.is_a? String + fail ArgumentError, t('bucket_type', bucket: bucket.inspect) unless Bucket === bucket + fail ArgumentError, t('string_type', string: key.inspect) unless String === key @bucket, @key = bucket, key @client = bucket.client diff --git a/lib/riak/robject.rb b/lib/riak/robject.rb index a9d688d7..793f1964 100644 --- a/lib/riak/robject.rb +++ b/lib/riak/robject.rb @@ -141,6 +141,7 @@ def store(options = {}) fail Conflict, self if conflict? fail ArgumentError, t('content_type_undefined') unless content_type.present? fail ArgumentError, t('zero_length_key') if key == '' + # NB: key can be nil to indicate that Riak should generate one fail ArgumentError, t('string_type', :string => key) unless key.nil? or String === key @bucket.client.store_object(self, default(options)) self