Module: HostOS::Interpreter
- Defined in:
- lib/host-os/interpreter.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:
Class Attribute Summary collapse
-
.cardinal? ⇒ true, false
(also: parrot?)
readonly
Whether the interpreter is the Parrot based Cardinal interpreter.
-
.exe ⇒ String?
readonly
Path name of current Ruby executable.
-
.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.
33 34 35 |
# File 'lib/host-os/interpreter.rb', line 33 def cardinal? id == :cardinal end |
.exe ⇒ String? (readonly)
Path name of current Ruby executable.
98 99 100 |
# File 'lib/host-os/interpreter.rb', line 98 def exe defined?(@exe) ? @exe : @exe = find_exe end |
.id ⇒ Symbol (readonly)
Returns interpreter identifier.
|
|
# File 'lib/host-os/interpreter.rb', line 102
|
.jit_enabled? ⇒ true, false (readonly)
Returns whether the interpreter currently uses a JIT Compiler.
65 66 67 |
# File 'lib/host-os/interpreter.rb', line 65 def jit_enabled? jit_type != :none end |
.jit_type ⇒ :mjit, ... (readonly)
Returns type of currently used JIT Compiler.
72 73 74 75 76 77 |
# File 'lib/host-os/interpreter.rb', line 72 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.
41 42 43 |
# File 'lib/host-os/interpreter.rb', line 41 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.
24 25 26 |
# File 'lib/host-os/interpreter.rb', line 24 def mri? id == :mri end |
.rbx? ⇒ true, false (readonly) Also known as: rubinius?
Returns whether the interpreter is the Rubinius Interpreter.
49 50 51 |
# File 'lib/host-os/interpreter.rb', line 49 def rbx? id == :rbx end |
.ree? ⇒ true, false (readonly) Also known as: enterprise?
Returns whether the interpreter is the Ruby Enterprise Edition.
57 58 59 |
# File 'lib/host-os/interpreter.rb', line 57 def ree? id == :ree end |
Class Method Details
.is?(what) ⇒ true, false
Returns whether the interpreter is the given identifier.
|
|
# File 'lib/host-os/interpreter.rb', line 105
|