Module: Argus::LedAnimation

Defined in:
lib/argus/led_animation.rb

Constant Summary collapse

NAMES =
[
  :blink_green_red,
  :blink_green,
  :blink_red,
  :blink_orange,
  :snake_green_red,
  :fire,
  :standard,
  :red,
  :green,
  :red_snake,
  :blank,
  :right_missile,
  :left_missile,
  :double_missile,
  :front_left_green_others_red,
  :front_right_green_others_red,
  :rear_right_green_others_red,
  :rear_left_green_others_red,
  :left_green_right_red,
  :left_red_right_green,
  :blink_standard,
]
VALUES =
{}

Class Method Summary collapse

Class Method Details

.lookup_name(numeric_value) ⇒ Object


31
32
33
# File 'lib/argus/led_animation.rb', line 31

def self.lookup_name(numeric_value)
  NAMES[numeric_value]
end

.lookup_value(symbolic_name) ⇒ Object


35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/argus/led_animation.rb', line 35

def self.lookup_value(symbolic_name)
  case symbolic_name
  when Symbol
    VALUES[symbolic_name]
  when Integer
    symbolic_name
  when /^\d+/
    symbolic_name.to_i
  when String
    VALUES[symbolic_name.intern]
  end
end