Class: Herve::Ruby::Engine

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#kindObject (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

#nameObject Also known as: to_s



16
17
18
# File 'lib/herve/ruby/engine.rb', line 16

def name
  @name.dup
end