File tree 1 file changed +20
-1
lines changed
1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -12,9 +12,28 @@ module NIO
12
12
def self . engine
13
13
ENGINE
14
14
end
15
+
16
+ def self . pure? ( env = ENV )
17
+ # The user has explicitly opted in to non-native implementation:
18
+ if env [ "NIO4R_PURE" ] == "true"
19
+ return true
20
+ end
21
+
22
+ # Native Ruby on Windows is not supported:
23
+ if ( Gem . win_platform? && !defined? ( JRUBY_VERSION ) )
24
+ return true
25
+ end
26
+
27
+ # M1 native extension is crashing on M1 (arm64):
28
+ if RUBY_PLATFORM =~ /darwin/ && RUBY_PLATFORM =~ /arm64/
29
+ return true
30
+ end
31
+
32
+ return false
33
+ end
15
34
end
16
35
17
- if ENV [ "NIO4R_PURE" ] == "true" || ( Gem . win_platform? && ! defined? ( JRUBY_VERSION ) ) || ( RUBY_PLATFORM =~ /darwin/ && RUBY_PLATFORM =~ /arm64/ )
36
+ if NIO . pure?
18
37
require "nio/monitor"
19
38
require "nio/selector"
20
39
require "nio/bytebuffer"
You can’t perform that action at this time.
0 commit comments