Sha256: ea9cd348f150bdeba1404f240e600449d945f06f86106c6435fb26b3e1c7d0f7

Contents?: true

Size: 947 Bytes

Versions: 14

Compression:

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

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
newrelic_rpm-3.9.9.275 test/performance/lib/performance/platform.rb
newrelic_rpm-3.9.8.273 test/performance/lib/performance/platform.rb
newrelic_rpm-3.9.7.266 test/performance/lib/performance/platform.rb
newrelic_rpm-3.9.6.257 test/performance/lib/performance/platform.rb
newrelic_rpm-3.9.5.251 test/performance/lib/performance/platform.rb
newrelic_rpm-3.9.4.245 test/performance/lib/performance/platform.rb
newrelic_rpm-3.9.3.241 test/performance/lib/performance/platform.rb
newrelic_rpm-3.9.2.239 test/performance/lib/performance/platform.rb
newrelic_rpm-3.9.1.236 test/performance/lib/performance/platform.rb
newrelic_rpm-3.9.0.229 test/performance/lib/performance/platform.rb
newrelic_rpm-3.8.1.221 test/performance/lib/performance/platform.rb
newrelic_rpm-3.8.0.218 test/performance/lib/performance/platform.rb
newrelic_rpm-3.7.3.204 test/performance/lib/performance/platform.rb
newrelic_rpm-3.7.3.199 test/performance/lib/performance/platform.rb