module RestClient::Platform
Public Class Methods
architecture()
click to toggle source
# File lib/restclient/platform.rb, line 32 def self.architecture "#{RbConfig::CONFIG['host_os']} #{RbConfig::CONFIG['host_cpu']}" end
default_user_agent()
click to toggle source
# File lib/restclient/platform.rb, line 45 def self.default_user_agent "rest-client/#{VERSION} (#{architecture}) #{ruby_agent_version}" end
jruby?()
click to toggle source
Return true if we are running on jruby.
@return [Boolean]
# File lib/restclient/platform.rb, line 27 def self.jruby? # defined on mri >= 1.9 RUBY_ENGINE == 'jruby' end
mac_mri?()
click to toggle source
Return true if we are running on a darwin-based Ruby platform. This will be false for jruby even on OS X.
@return [Boolean]
# File lib/restclient/platform.rb, line 9 def self.mac_mri? RUBY_PLATFORM.include?('darwin') end
ruby_agent_version()
click to toggle source
# File lib/restclient/platform.rb, line 36 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
windows?()
click to toggle source
Return true if we are running on Windows
.
@return [Boolean]
# File lib/restclient/platform.rb, line 17 def self.windows? # Ruby only sets File::ALT_SEPARATOR on Windows, and the Ruby standard # library uses that to test what platform it's on. !!File::ALT_SEPARATOR end