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 47 |
# File 'lib/bson/environment.rb', line 44 def ree? return false unless defined?(RUBY_ENGINE) RUBY_ENGINE == "ruby" && RUBY_DESCRIPTION =~ /Enterprise/ end |
#retaining_hash_order? ⇒ true, false
Does the Ruby runtime we are using support ordered hashes?
57 58 59 |
# File 'lib/bson/environment.rb', line 57 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?
69 70 71 |
# File 'lib/bson/environment.rb', line 69 def ruby_18? RUBY_VERSION < "1.9" end |