lib/algoliasearch.rb in algoliasearch-1.10.0 vs lib/algoliasearch.rb in algoliasearch-1.11.0
- old
+ new
@@ -6,10 +6,17 @@
## ----------------------------------------------------------------------
require "rubygems"
require "bundler/setup"
require 'json'
-require 'httpclient'
+if !defined?(RUBY_ENGINE) && defined?(RUBY_VERSION) && RUBY_VERSION == '1.8.7'
+ # work-around a limitation from nahi/httpclient, using the undefined RUBY_ENGINE constant
+ RUBY_ENGINE = 'ruby1.8'
+ require 'httpclient'
+ Object.send(:remove_const, :RUBY_ENGINE)
+else
+ require 'httpclient'
+end
require 'date'
require 'cgi'
cwd = Pathname(__FILE__).dirname
$:.unshift(cwd.to_s) unless $:.include?(cwd.to_s) || $:.include?(cwd.expand_path.to_s)