Module: BSON::Environment

Extended by:
Environment
Included in:
Environment
Defined in:
lib/bson/environment.rb

Overview

Provides static helper methods around determining what environment is running without polluting the global namespace.

Since:

  • 2.0.0

Instance Method Summary collapse

Instance Method Details

#jruby?true, false

Determine if we are using JRuby or not.

Examples:

Are we running with JRuby?

Environment.jruby?

Returns:

  • (true, false)

    If JRuby is our vm.

Since:

  • 2.0.0



34
35
36
# File 'lib/bson/environment.rb', line 34

def jruby?
  @jruby ||= defined?(JRUBY_VERSION)
end

#ruby_1_9?true, false

Deprecated.

Determine if we are using Ruby version 1.9.

Examples:

Are we running with Ruby version 1.9?

Environment.ruby_1_9?

Returns:

  • (true, false)

    If the Ruby version is 1.9.

Since:

  • 4.2.0



47
48
49
# File 'lib/bson/environment.rb', line 47

def ruby_1_9?
  @ruby_1_9 ||= RUBY_VERSION < '2.0.0'
end