Module: HostOS::Interpreter
- Defined in:
- lib/host-os.rb
Overview
This module allows to identify the used Ruby interpreter.
Besides here documented boolean attributes you can also check for any other boolean attribute or interpreter name:
Constant Summary collapse
- ID =
Returns interpreter identifier.
identify
Class Attribute Summary collapse
-
.cardinal? ⇒ true, false
(also: parrot?)
readonly
Whether the interpreter is the Parrot based Cardinal interpreter.
-
.id ⇒ Symbol
readonly
Interpreter identifier.
-
.jit_enabled? ⇒ true, false
readonly
Whether the interpreter currently uses a JIT Compiler.
-
.jit_type ⇒ :mjit, ...
readonly
Type of currently used JIT Compiler.
-
.jruby? ⇒ true, false
(also: java?)
readonly
Whether the interpreter is the Java based JRuby Interpreter.
-
.mri? ⇒ true, false
(also: cruby?, default?)
readonly
Whether the interpreter is the Yukihiro Matsumoto's C-based (default) Ruby Interpreter.
-
.rbx? ⇒ true, false
(also: rubinius?)
readonly
Whether the interpreter is the Rubinius Interpreter.
-
.ree? ⇒ true, false
(also: enterprise?)
readonly
Whether the interpreter is the Ruby Enterprise Edition.
Class Method Summary collapse
-
.is?(what) ⇒ true, false
Whether the interpreter is the given identifier.
Class Attribute Details
.cardinal? ⇒ true, false (readonly) Also known as: parrot?
Returns whether the interpreter is the Parrot based Cardinal interpreter.
125 126 127 |
# File 'lib/host-os.rb', line 125 def cardinal? ID == :cardinal end |
.id ⇒ Symbol (readonly)
Returns interpreter identifier.
109 110 111 |
# File 'lib/host-os.rb', line 109 def id ID end |
.jit_enabled? ⇒ true, false (readonly)
Returns whether the interpreter currently uses a JIT Compiler.
157 158 159 |
# File 'lib/host-os.rb', line 157 def jit_enabled? jit_type != :none end |
.jit_type ⇒ :mjit, ... (readonly)
Returns type of currently used JIT Compiler.
164 165 166 167 168 169 |
# File 'lib/host-os.rb', line 164 def jit_type return :mjit if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? return :yjit if defined?(RubyVM::YJIT) && RubyVM::YJIT.enabled? return :rjit if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? jruby? ? :java : :none end |
.jruby? ⇒ true, false (readonly) Also known as: java?
Returns whether the interpreter is the Java based JRuby Interpreter.
133 134 135 |
# File 'lib/host-os.rb', line 133 def jruby? ID == :jruby end |
.mri? ⇒ true, false (readonly) Also known as: cruby?, default?
Returns whether the interpreter is the Yukihiro Matsumoto's C-based (default) Ruby Interpreter.
116 117 118 |
# File 'lib/host-os.rb', line 116 def mri? ID == :mri end |
.rbx? ⇒ true, false (readonly) Also known as: rubinius?
Returns whether the interpreter is the Rubinius Interpreter.
141 142 143 |
# File 'lib/host-os.rb', line 141 def rbx? ID == :rbx end |
.ree? ⇒ true, false (readonly) Also known as: enterprise?
Returns whether the interpreter is the Ruby Enterprise Edition.
149 150 151 |
# File 'lib/host-os.rb', line 149 def ree? ID == :ree end |
Class Method Details
.is?(what) ⇒ true, false
Returns whether the interpreter is the given identifier.
|
# File 'lib/host-os.rb', line 176
|