Module: Develry::Platform
- Included in:
- Develry
- Defined in:
- lib/develry/platform.rb
Overview
Provides methods to determine the ruby platform
Constant Summary collapse
- DEFAULT_RVM_NAME =
'mri'.freeze
Instance Method Summary collapse
-
#jit? ⇒ true, false
private
Test for being executed under rubies with a JIT.
-
#jruby? ⇒ true, false
private
Test for being executed under JRuby.
-
#rbx? ⇒ true, false
private
Test for being executed under rbx.
-
#ruby18? ⇒ true, false
private
Test for 1.8 mode.
-
#ruby19? ⇒ true, false
private
Test for 1.9 mode.
-
#ruby20? ⇒ true, false
private
Test for 2.0 mode.
-
#ruby_engine ⇒ String
private
Return Ruby engine string.
-
#rvm ⇒ String
private
Return RVM string.
-
#rvm_name ⇒ String
private
Return RVM name.
Instance Method Details
#jit? ⇒ true, false
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Test for being executed under rubies with a JIT
75 76 77 |
# File 'lib/develry/platform.rb', line 75 def jit? jruby? || rbx? end |
#jruby? ⇒ true, false
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Test for being executed under JRuby
49 50 51 |
# File 'lib/develry/platform.rb', line 49 def jruby? ruby_engine == 'jruby' end |
#rbx? ⇒ true, false
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Test for being executed under rbx
62 63 64 |
# File 'lib/develry/platform.rb', line 62 def rbx? ruby_engine == 'rbx' end |
#ruby18? ⇒ true, false
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Test for 1.8 mode
88 89 90 |
# File 'lib/develry/platform.rb', line 88 def ruby18? RUBY_VERSION.start_with?('1.8.') end |
#ruby19? ⇒ true, false
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Test for 1.9 mode
101 102 103 |
# File 'lib/develry/platform.rb', line 101 def ruby19? RUBY_VERSION.start_with?('1.9.') end |
#ruby20? ⇒ true, false
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Test for 2.0 mode
114 115 116 |
# File 'lib/develry/platform.rb', line 114 def ruby20? RUBY_VERSION.start_with?('2.0.') end |
#ruby_engine ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return Ruby engine string
15 16 17 |
# File 'lib/develry/platform.rb', line 15 def ruby_engine @ruby_engine ||= (defined?(RUBY_ENGINE) && RUBY_ENGINE || 'ruby').freeze end |
#rvm ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return RVM string
36 37 38 |
# File 'lib/develry/platform.rb', line 36 def rvm @rvm ||= "#{rvm_name}-#{RUBY_VERSION}".freeze end |
#rvm_name ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return RVM name
24 25 26 27 28 29 |
# File 'lib/develry/platform.rb', line 24 def rvm_name @rvm_name ||= begin engine = ruby_engine engine == 'ruby' ? DEFAULT_RVM_NAME : engine end end |