Sha256: 81123feed5d432123fdaf6408570806e6306d9d98816333007fa32ca8cea78b0

Contents?: true

Size: 1.27 KB

Versions: 118

Compression:

Stored size: 1.27 KB

Contents

module Concurrent
  module Utility

    # @!visibility private
    module EngineDetector
      def on_jruby?
        ruby_engine == 'jruby'
      end

      def on_jruby_9000?
        on_jruby? && ruby_version(JRUBY_VERSION, :>=, 9, 0, 0)
      end

      def on_cruby?
        ruby_engine == 'ruby'
      end

      def on_rbx?
        ruby_engine == 'rbx'
      end

      def on_truffleruby?
        ruby_engine == 'truffleruby'
      end

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

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

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

      def ruby_engine
        defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
      end

      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
    end
  end

  # @!visibility private
  extend Utility::EngineDetector
end

Version data entries

118 entries across 104 versions & 25 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/utility/engine.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/utility/engine.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/utility/engine.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/utility/engine.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/utility/engine.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/utility/engine.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/utility/engine.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/utility/engine.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/utility/engine.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/utility/engine.rb
mumukit-content-type-1.11.1 vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/utility/engine.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/utility/engine.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/utility/engine.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/utility/engine.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/utility/engine.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/utility/engine.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/utility/engine.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/utility/engine.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/utility/engine.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/utility/engine.rb