Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 4 files changed
  • 0 commit comments
  • 1 contributor
Showing with 6 additions and 4 deletions.
  1. +1 −0 Rakefile
  2. +1 −0 couchrest.gemspec
  3. +2 −2 lib/couchrest.rb
  4. +2 −2 lib/couchrest/rest_api.rb
View
1 Rakefile
@@ -2,6 +2,7 @@ require 'rubygems'
require 'bundler'
require 'rspec/core/rake_task'
require "rake/rdoctask"
+require 'metric_fu'
Bundler::GemHelper.install_tasks
View
1 couchrest.gemspec
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
s.add_dependency(%q<rest-client>, ["~> 1.6.1"])
s.add_dependency(%q<mime-types>, ["~> 1.15"])
s.add_dependency(%q<multi_json>, ["~> 1.0.0"])
+ s.add_dependency(%q<msgpack>, ["~> 0.4.6"])
s.add_development_dependency(%q<json>, ["~> 1.5.1"])
s.add_development_dependency(%q<rspec>, "~> 2.6.0")
end
View
4 lib/couchrest.rb
@@ -14,7 +14,7 @@
require 'rest_client'
require 'multi_json'
-
+require 'msgpack'
# Not sure why this is required, so removed until a reason is found!
$:.unshift File.dirname(__FILE__) unless
$:.include?(File.dirname(__FILE__)) ||
@@ -111,7 +111,7 @@ def database url
def paramify_url url, params = {}
if params && !params.empty?
query = params.collect do |k,v|
- v = MultiJson.encode(v) if %w{key startkey endkey}.include?(k.to_s)
+ v = MessagePack::pack(v) if %w{key startkey endkey}.include?(k.to_s)
"#{k}=#{CGI.escape(v.to_s)}"
end.join("&")
url = "#{url}?#{query}"
View
4 lib/couchrest/rest_api.rb
@@ -141,13 +141,13 @@ def payload_from_doc(doc, opts = {})
if (opts.delete(:raw) || doc.nil? || doc.is_a?(IO) || doc.is_a?(Tempfile))
doc
else
- MultiJson.encode(doc.respond_to?(:as_couch_json) ? doc.as_couch_json : doc)
+ MessagePack::pack(doc.respond_to?(:as_couch_json) ? doc.as_couch_json : doc)
end
end
# Parse the response provided.
def parse_response(result, opts = {})
- (opts.delete(:raw) || opts.delete(:head)) ? result : MultiJson.decode(result, opts.update(:max_nesting => false))
+ (opts.delete(:raw) || opts.delete(:head)) ? result : MessagePack::unpack(result)
end
# An array of all the options that should be passed through to restclient.

No commit comments for this range

Something went wrong with that request. Please try again.