mirror of
https://github.com/rest-client/rest-client.git
synced 2022-11-09 13:49:40 -05:00
Cherry-pick platform module from master.
This commit is contained in:
parent
ece425c199
commit
6e01cc9d17
2 changed files with 31 additions and 0 deletions
|
@ -10,6 +10,7 @@ rescue LoadError => e
|
|||
end
|
||||
|
||||
require File.dirname(__FILE__) + '/restclient/version'
|
||||
require File.dirname(__FILE__) + '/restclient/platform'
|
||||
require File.dirname(__FILE__) + '/restclient/exceptions'
|
||||
require File.dirname(__FILE__) + '/restclient/request'
|
||||
require File.dirname(__FILE__) + '/restclient/abstract_response'
|
||||
|
|
30
lib/restclient/platform.rb
Normal file
30
lib/restclient/platform.rb
Normal file
|
@ -0,0 +1,30 @@
|
|||
module RestClient
|
||||
module Platform
|
||||
# Return true if we are running on a darwin-based Ruby platform. This will
|
||||
# be false for jruby even on OS X.
|
||||
#
|
||||
# @return [Boolean]
|
||||
def self.mac?
|
||||
RUBY_PLATFORM.include?('darwin')
|
||||
end
|
||||
|
||||
# Return true if we are running on Windows.
|
||||
#
|
||||
# @return [Boolean]
|
||||
#
|
||||
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
|
||||
|
||||
# Return true if we are running on jruby.
|
||||
#
|
||||
# @return [Boolean]
|
||||
#
|
||||
def self.jruby?
|
||||
# defined on mri >= 1.9
|
||||
RUBY_ENGINE == 'jruby'
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Reference in a new issue