Module: BSON::Environment
Overview
Provides static helper methods around determining what environment is running without polluting the global namespace.
Instance Method Summary collapse
-
#jruby? ⇒ true, false
Determine if we are using JRuby or not.
-
#ree? ⇒ true, false
Determine if we are using REE or not.
-
#retaining_hash_order? ⇒ true, false
Does the Ruby runtime we are using support ordered hashes?.
-
#ruby_18? ⇒ true, false
Are we running in a ruby runtime that is version 1.8.x?.
Instance Method Details
#jruby? ⇒ true, false
Determine if we are using JRuby or not.
32 33 34 |
# File 'lib/bson/environment.rb', line 32 def jruby? defined?(JRUBY_VERSION) end |
#ree? ⇒ true, false
Determine if we are using REE or not.
44 45 46 |
# File 'lib/bson/environment.rb', line 44 def ree? RUBY_ENGINE == "ruby" && RUBY_DESCRIPTION =~ /Enterprise/ end |
#retaining_hash_order? ⇒ true, false
Does the Ruby runtime we are using support ordered hashes?
56 57 58 |
# File 'lib/bson/environment.rb', line 56 def retaining_hash_order? jruby? || RUBY_VERSION > "1.9.1" end |
#ruby_18? ⇒ true, false
Are we running in a ruby runtime that is version 1.8.x?
68 69 70 |
# File 'lib/bson/environment.rb', line 68 def ruby_18? RUBY_VERSION < "1.9" end |