Class: Weese::Rail::Line::String

Inherits:
Object
  • Object
show all
Defined in:
lib/weese/rail/line.rb

Overview

Extensions to String relating to Lines

Instance Method Summary collapse

Instance Method Details

#line?bool

Checks if this Weese::Rail::Line::String is a Line code

Returns:

  • (bool)

    If the current string is a Line Code



22
23
24
25
26
27
28
29
# File 'lib/weese/rail/line.rb', line 22

def line?
  case self
  when Line::RD, Line::BL, Line::YL, Line::YL, Line::OR, Line::GR, Line::SV, Line::YLRP
    true
  else
    false
  end
end

#line_nameString

Line name for the current Line

Returns:

  • (String)

    Human-presentable Line name



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/weese/rail/line.rb', line 36

def line_name
  case self
  when Line::RD
    'Red'
  when Line::BL
    'Blue'
  when Line::YL
    'Yellow'
  when Line::OR
    'Orange'
  when Line::GR
    'Green'
  when Line::SV
    'Silver'
  when Line::YLRP
    'Yellow Line Rush Plus'
  else
    raise 'Invalid line'
  end
end