Sha256: aa8cea068ba9a878da682376903709d82a8f5add5fced4c1d33a20106f824df4

Contents?: true

Size: 1009 Bytes

Versions: 20

Compression:

Stored size: 1009 Bytes

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

module Performance
  class Platform
    def self.current
      @current ||= self.new
    end

    def jruby?
      defined?(JRUBY_VERSION)
    end

    def ree?
      defined?(RUBY_DESCRIPTION) && RUBY_DESCRIPTION =~ /MBARI/
    end

    def match?(p)
      case p
      when :jruby   then jruby?
      when :mri     then !jruby?
      when :ree     then !jruby? && ree?
      when :mri_18  then !jruby? && RUBY_VERSION =~ /^1\.8\./
      when :mri_19  then !jruby? && RUBY_VERSION =~ /^1\.9\./
      when :mri_193 then !jruby? && RUBY_VERSION =~ /^1\.9\.3/
      when :mri_20  then !jruby? && RUBY_VERSION =~ /^2\.0\./
      when :mri_21  then !jruby? && RUBY_VERSION =~ /^2\.1\./
      when :mri_22  then !jruby? && RUBY_VERSION =~ /^2\.2\./
      end
    end

    def match_any?(platforms)
      platforms.any? { |p| match?(p) }
    end
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
newrelic_rpm-3.16.2.321 test/performance/lib/performance/platform.rb
newrelic_rpm-3.16.1.320 test/performance/lib/performance/platform.rb
newrelic_rpm-3.16.0.318 test/performance/lib/performance/platform.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-3.15.2.317/test/performance/lib/performance/platform.rb
newrelic_rpm-3.15.2.317 test/performance/lib/performance/platform.rb
newrelic_rpm-3.15.1.316 test/performance/lib/performance/platform.rb
newrelic_rpm-3.15.0.314 test/performance/lib/performance/platform.rb
newrelic_rpm-3.14.3.313 test/performance/lib/performance/platform.rb
newrelic_rpm-3.14.2.312 test/performance/lib/performance/platform.rb
newrelic_rpm-3.14.1.311 test/performance/lib/performance/platform.rb
newrelic_rpm-3.14.0.305 test/performance/lib/performance/platform.rb
newrelic_rpm-3.13.2.302 test/performance/lib/performance/platform.rb
newrelic_rpm-3.13.1.300 test/performance/lib/performance/platform.rb
newrelic_rpm-3.13.0.299 test/performance/lib/performance/platform.rb
newrelic_rpm-3.12.1.298 test/performance/lib/performance/platform.rb
newrelic_rpm-3.12.0.288 test/performance/lib/performance/platform.rb
newrelic_rpm-3.11.2.286 test/performance/lib/performance/platform.rb
newrelic_rpm-3.11.1.284 test/performance/lib/performance/platform.rb
newrelic_rpm-3.11.0.283 test/performance/lib/performance/platform.rb
newrelic_rpm-3.10.0.279 test/performance/lib/performance/platform.rb