forked from puma/puma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
detect.rb
42 lines (30 loc) · 730 Bytes
/
detect.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# frozen_string_literal: true
# This file can be loaded independently of puma.rb, so it cannot have any code
# that assumes puma.rb is loaded.
module Puma
# @version 5.2.1
HAS_FORK = ::Process.respond_to? :fork
IS_JRUBY = Object.const_defined? :JRUBY_VERSION
IS_OSX = RUBY_PLATFORM.include? 'darwin'
IS_WINDOWS = !!(RUBY_PLATFORM =~ /mswin|ming|cygwin/) ||
IS_JRUBY && RUBY_DESCRIPTION.include?('mswin')
# @version 5.2.0
IS_MRI = (RUBY_ENGINE == 'ruby' || RUBY_ENGINE.nil?)
def self.jruby?
IS_JRUBY
end
def self.osx?
IS_OSX
end
def self.windows?
IS_WINDOWS
end
# @version 5.0.0
def self.mri?
IS_MRI
end
# @version 5.0.0
def self.forkable?
HAS_FORK
end
end