Module: RestClient::Platform

Defined in:
lib/restclient/platform.rb

Class Method Summary collapse

Class Method Details

.jruby?Boolean

Return true if we are running on jruby.

Returns:

  • (Boolean)

25
26
27
# File 'lib/restclient/platform.rb', line 25

def self.jruby?
  RUBY_PLATFORM == 'java'
end

.mac?Boolean

Return true if we are running on a darwin-based Ruby platform. This will be false for jruby even on OS X.

Returns:

  • (Boolean)

7
8
9
# File 'lib/restclient/platform.rb', line 7

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

.windows?Boolean

Return true if we are running on Windows.

Returns:

  • (Boolean)

15
16
17
18
19
# File 'lib/restclient/platform.rb', line 15

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