lib/riak/bucket.rb in ripple-0.5.0 vs lib/riak/bucket.rb in ripple-0.5.1

- old
+ new

@@ -44,11 +44,11 @@ # @see Client#bucket def load(response={}) unless response.try(:[], :headers).try(:[],'content-type').try(:first) =~ /json$/ raise Riak::InvalidResponse.new({"content-type" => ["application/json"]}, response[:headers], t("loading_bucket", :name => name)) end - payload = JSON.parse(response[:body]) + payload = ActiveSupport::JSON.decode(response[:body]) @keys = payload['keys'].map {|k| URI.unescape(k) } if payload['keys'] @props = payload['props'] if payload['props'] self end @@ -61,10 +61,10 @@ # @option options [Boolean] :reload (false) If present, will force reloading of the bucket's keys from Riak # @return [Array<String>] Keys in this bucket def keys(options={}) if block_given? @client.http.get(200, @client.prefix, name, {:props => false}, {}) do |chunk| - obj = JSON.parse(chunk) rescue {} + obj = ActiveSupport::JSON.decode(chunk) rescue {} yield obj['keys'].map {|k| URI.unescape(k) } if obj['keys'] end elsif @keys.nil? || options[:reload] response = @client.http.get(200, @client.prefix, name, {:props => false}, {}) load(response)