diff options
author | Louise Crow <louise.crow@gmail.com> | 2011-03-28 15:18:21 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2011-03-28 15:18:21 +0100 |
commit | 73ae7435e0aaa83518d51f390e4f99778df85b4f (patch) | |
tree | 5de39cdb844ca8e8d237f4def0f35586d7b2042b /vendor/gems/json-1.5.1/lib/json/ext.rb | |
parent | 6e36729b44673a0e77f03e100d094ebf020e8e32 (diff) | |
parent | 22c25e42847d41924d43d31f3ef67be1ae4a155e (diff) |
Merge branch 'master' of git@github.com:sebbacon/alaveteli
Diffstat (limited to 'vendor/gems/json-1.5.1/lib/json/ext.rb')
-rw-r--r-- | vendor/gems/json-1.5.1/lib/json/ext.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/vendor/gems/json-1.5.1/lib/json/ext.rb b/vendor/gems/json-1.5.1/lib/json/ext.rb new file mode 100644 index 000000000..1fbc3fd7d --- /dev/null +++ b/vendor/gems/json-1.5.1/lib/json/ext.rb @@ -0,0 +1,28 @@ +require 'json/common' + +module JSON + # This module holds all the modules/classes that implement JSON's + # functionality as C extensions. + module Ext + begin + if defined?(RUBY_ENGINE) == 'constant' and RUBY_ENGINE == 'ruby' and RUBY_VERSION =~ /\A1\.9\./ + require 'json/ext/1.9/parser' + require 'json/ext/1.9/generator' + elsif !defined?(RUBY_ENGINE) && RUBY_VERSION =~ /\A1\.8\./ + require 'json/ext/1.8/parser' + require 'json/ext/1.8/generator' + else + require 'json/ext/parser' + require 'json/ext/generator' + end + rescue LoadError + require 'json/ext/parser' + require 'json/ext/generator' + end + $DEBUG and warn "Using Ext extension for JSON." + JSON.parser = Parser + JSON.generator = Generator + end + + JSON_LOADED = true unless defined?(::JSON::JSON_LOADED) +end |