Sha256: 9eec0a3c02b5ecf0ea26935a13de5dc507f8b775616b4305fd722824398021f5

Contents?: true

Size: 779 Bytes

Versions: 1

Compression:

Stored size: 779 Bytes

Contents

require 'rbconfig'

module RestMan
  module Platform
    # :include: _doc/lib/restman/platform/mac_mri?.rdoc
    def self.mac_mri?
      RUBY_PLATFORM.include?('darwin')
    end

    # :include: _doc/lib/restman/platform/jruby?.rdoc
    def self.jruby?
      # defined on mri >= 1.9
      RUBY_ENGINE == 'jruby'
    end

    def self.architecture
      "#{RbConfig::CONFIG['host_os']} #{RbConfig::CONFIG['host_cpu']}"
    end

    def self.ruby_agent_version
      case RUBY_ENGINE
      when 'jruby'
        "jruby/#{JRUBY_VERSION} (#{RUBY_VERSION}p#{RUBY_PATCHLEVEL})"
      else
        "#{RUBY_ENGINE}/#{RUBY_VERSION}p#{RUBY_PATCHLEVEL}"
      end
    end

    def self.default_user_agent
      "rest-man/#{VERSION} (#{architecture}) #{ruby_agent_version}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rest-man-1.1.0 lib/restman/platform.rb