123456789_123456789_123456789_123456789_123456789_

Module: Concurrent::Utility::EngineDetector

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Extended In:
Defined in: lib/concurrent-ruby/concurrent/utility/engine.rb

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#on_cruby?Boolean (readonly)

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/utility/engine.rb', line 7

def on_cruby?
  RUBY_ENGINE == 'ruby'
end

#on_jruby?Boolean (readonly)

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/utility/engine.rb', line 11

def on_jruby?
  RUBY_ENGINE == 'jruby'
end

#on_linux?Boolean (readonly)

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/utility/engine.rb', line 27

def on_linux?
  !(RbConfig::CONFIG['host_os'] =~ /linux/).nil?
end

#on_osx?Boolean (readonly)

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/utility/engine.rb', line 23

def on_osx?
  !(RbConfig::CONFIG['host_os'] =~ /darwin|mac os/).nil?
end

#on_truffleruby?Boolean (readonly)

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/utility/engine.rb', line 15

def on_truffleruby?
  RUBY_ENGINE == 'truffleruby'
end

#on_windows?Boolean (readonly)

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/utility/engine.rb', line 19

def on_windows?
  !(RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/).nil?
end

Instance Method Details

#ruby_version(version = RUBY_VERSION, comparison, major, minor, patch)

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/utility/engine.rb', line 31

def ruby_version(version = RUBY_VERSION, comparison, major, minor, patch)
  result      = (version.split('.').map(&:to_i) <=> [major, minor, patch])
  comparisons = { :== => [0],
                  :>= => [1, 0],
                  :<= => [-1, 0],
                  :>  => [1],
                  :<  => [-1] }
  comparisons.fetch(comparison).include? result
end