Sha256: 1262caad4d911dc8cbc0f40ed7f10741656aca52ed9fead5228713f50c0c80a6

Contents?: true

Size: 885 Bytes

Versions: 6

Compression:

Stored size: 885 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\./
      end
    end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
newrelic_rpm-3.7.2.195 test/performance/lib/performance/platform.rb
newrelic_rpm-3.7.2.192 test/performance/lib/performance/platform.rb
newrelic_rpm-3.7.2.190.beta test/performance/lib/performance/platform.rb
newrelic_rpm-3.7.1.188 test/performance/lib/performance/platform.rb
newrelic_rpm-3.7.1.182 test/performance/lib/performance/platform.rb
newrelic_rpm-3.7.1.180 test/performance/lib/performance/platform.rb