class Lapidarist::Level

Attributes

index[R]
name[R]

Public Class Methods

from(name) click to toggle source
# File lib/lapidarist/level.rb, line 12
def self.from(name)
  return unless name
  Lapidarist::LEVELS.detect { |l| l.name == name.to_sym }
end
new(name:, index:) click to toggle source
# File lib/lapidarist/level.rb, line 7
def initialize(name:, index:)
  @name = name
  @index = index
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/lapidarist/level.rb, line 21
def <=>(other)
  return 1 if index < other.index
  return 0 if index == other.index
  return -1 if index > other.index
end
to_s() click to toggle source
# File lib/lapidarist/level.rb, line 17
def to_s
  name.to_s
end