Skip to content

Commit 0062a7e

Browse files
committed
Moved EngineDetector into the Utility module.
1 parent 37a64a9 commit 0062a7e

File tree

2 files changed

+28
-26
lines changed

2 files changed

+28
-26
lines changed

lib/concurrent/utility/engine.rb

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
11
module Concurrent
2+
module Utility
23

3-
module EngineDetector
4-
def on_jruby?
5-
ruby_engine == 'jruby'
6-
end
4+
module EngineDetector
5+
def on_jruby?
6+
ruby_engine == 'jruby'
7+
end
78

8-
def on_jruby_9000?
9-
on_jruby? && 0 == (JRUBY_VERSION =~ /^9\.0\.0\.0/)
10-
end
9+
def on_jruby_9000?
10+
on_jruby? && 0 == (JRUBY_VERSION =~ /^9\.0\.0\.0/)
11+
end
1112

12-
def on_cruby?
13-
ruby_engine == 'ruby'
14-
end
13+
def on_cruby?
14+
ruby_engine == 'ruby'
15+
end
1516

16-
def on_rbx?
17-
ruby_engine == 'rbx'
18-
end
17+
def on_rbx?
18+
ruby_engine == 'rbx'
19+
end
1920

20-
def ruby_engine
21-
defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
22-
end
21+
def ruby_engine
22+
defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
23+
end
2324

24-
def ruby_version(comparison, major, minor = 0, patch = 0)
25-
result = (RUBY_VERSION.split('.').map(&:to_i) <=> [major, minor, patch])
26-
comparisons = { :== => [0],
27-
:>= => [1, 0],
28-
:<= => [-1, 0],
29-
:> => [1],
30-
:< => [-1] }
31-
comparisons.fetch(comparison).include? result
25+
def ruby_version(comparison, major, minor = 0, patch = 0)
26+
result = (RUBY_VERSION.split('.').map(&:to_i) <=> [major, minor, patch])
27+
comparisons = { :== => [0],
28+
:>= => [1, 0],
29+
:<= => [-1, 0],
30+
:> => [1],
31+
:< => [-1] }
32+
comparisons.fetch(comparison).include? result
33+
end
3234
end
3335
end
3436

35-
extend EngineDetector
37+
extend Utility::EngineDetector
3638
end

spec/support/example_group_extensions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def delta(v1, v2)
1313
return (v1 - v2).abs
1414
end
1515

16-
include EngineDetector
16+
include Utility::EngineDetector
1717

1818
def use_c_extensions?
1919
Concurrent.allow_c_extensions?

0 commit comments

Comments
 (0)