Class: Herve::Ruby::Engine
- Inherits:
-
Object
- Object
- Herve::Ruby::Engine
- Defined in:
- lib/herve/ruby/engine.rb
Constant Summary collapse
- KINDS =
Known engines, in priority order
i[ruby jruby truffleruby mruby].freeze
Instance Attribute Summary collapse
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
-
#initialize(name) ⇒ Engine
constructor
A new instance of Engine.
- #name ⇒ Object (also: #to_s)
Constructor Details
#initialize(name) ⇒ Engine
Returns a new instance of Engine.
11 12 13 14 |
# File 'lib/herve/ruby/engine.rb', line 11 def initialize(name) @name = name @kind = KINDS.find { |k| k.to_s == name } || :unknown end |
Instance Attribute Details
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
9 10 11 |
# File 'lib/herve/ruby/engine.rb', line 9 def kind @kind end |
Instance Method Details
#<=>(other) ⇒ Object
21 22 23 |
# File 'lib/herve/ruby/engine.rb', line 21 def <=>(other) priority(kind) <=> priority(other.kind) end |
#==(other) ⇒ Object
25 26 27 |
# File 'lib/herve/ruby/engine.rb', line 25 def ==(other) kind == other.kind end |
#name ⇒ Object Also known as: to_s
16 17 18 |
# File 'lib/herve/ruby/engine.rb', line 16 def name @name.dup end |