Sha256: df689913951ae1894e23a0e6d169ba86e7cf71ec7a328a93d54042e75b4b88b3

Contents?: true

Size: 819 Bytes

Versions: 2

Compression:

Stored size: 819 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 match?(p)
      case p
      when :jruby   then jruby?
      when :mri     then !jruby?
      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\./
      when :mri_23  then !jruby? && RUBY_VERSION =~ /^2\.3\./
      when :mri_24  then !jruby? && RUBY_VERSION =~ /^2\.4\./
      end
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
newrelic_rpm-4.1.0.333 test/performance/lib/performance/platform.rb
newrelic_rpm-4.0.0.332 test/performance/lib/performance/platform.rb