module Concurrent::Utility::EngineDetector

@!visibility private

Public Instance Methods

on_cruby?() click to toggle source
# File lib/concurrent/utility/engine.rb, line 14
def on_cruby?
  ruby_engine == 'ruby'
end
on_jruby?() click to toggle source
# File lib/concurrent/utility/engine.rb, line 6
def on_jruby?
  ruby_engine == 'jruby'
end
on_jruby_9000?() click to toggle source
# File lib/concurrent/utility/engine.rb, line 10
def on_jruby_9000?
  on_jruby? && ruby_version(:>=, 9, 0, 0, JRUBY_VERSION)
end
on_linux?() click to toggle source
# File lib/concurrent/utility/engine.rb, line 34
def on_linux?
  !(RbConfig::CONFIG['host_os'] =~ /linux/).nil?
end
on_osx?() click to toggle source
# File lib/concurrent/utility/engine.rb, line 30
def on_osx?
  !(RbConfig::CONFIG['host_os'] =~ /darwin|mac os/).nil?
end
on_rbx?() click to toggle source
# File lib/concurrent/utility/engine.rb, line 18
def on_rbx?
  ruby_engine == 'rbx'
end
on_truffle?() click to toggle source
# File lib/concurrent/utility/engine.rb, line 22
def on_truffle?
  ruby_engine == 'jruby+truffle'
end
on_windows?() click to toggle source
# File lib/concurrent/utility/engine.rb, line 26
def on_windows?
  !(RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/).nil?
end
ruby_engine() click to toggle source
# File lib/concurrent/utility/engine.rb, line 38
def ruby_engine
  defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
end
ruby_version(comparison, major, minor, patch, version = RUBY_VERSION) click to toggle source
# File lib/concurrent/utility/engine.rb, line 42
def ruby_version(comparison, major, minor, patch, version = RUBY_VERSION)
  result      = (version.split('.').map(&:to_i) <=> [major, minor, patch])
  comparisons = { :== => [0],
                  :>= => [1, 0],
                  :<= => [-1, 0],
                  :>  => [1],
                  :<  => [-1] }
  comparisons.fetch(comparison).include? result
end