Module: RestMan::Platform

Defined in:
lib/restman/platform.rb

Class Method Summary collapse

Class Method Details

.architectureObject



16
17
18
# File 'lib/restman/platform.rb', line 16

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

.default_user_agentObject



29
30
31
# File 'lib/restman/platform.rb', line 29

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

.jruby?Boolean

:include: _doc/lib/restman/platform/jruby?.rdoc

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/restman/platform.rb', line 11

def self.jruby?
  # defined on mri >= 1.9
  RUBY_ENGINE == 'jruby'
end

.mac_mri?Boolean

:include: _doc/lib/restman/platform/mac_mri?.rdoc

Returns:

  • (Boolean)


6
7
8
# File 'lib/restman/platform.rb', line 6

def self.mac_mri?
  RUBY_PLATFORM.include?('darwin')
end

.ruby_agent_versionObject



20
21
22
23
24
25
26
27
# File 'lib/restman/platform.rb', line 20

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