class MovingsignApi::DisplaySpeed

Text display mode speed sending

Attributes

key[RW]

@return [Symbol] Display speed constant, one of {#faster}, {#normal}, {#slow}

Public Class Methods

display_speed(key, code) click to toggle source

@!visibility private

# File lib/movingsign_api/commands/internal/display_speed.rb, line 9
def self.display_speed(key, code)
  register(key, code)
end
new(speed) click to toggle source
# File lib/movingsign_api/commands/internal/display_speed.rb, line 30
def initialize(speed)
  @key = speed
end
parse(input) click to toggle source

Parses the supplied input into a {DisplaySpeed} instance if possible @raise InvalidInputError on invalid input @return [DisplaySpeed]

# File lib/movingsign_api/commands/internal/display_speed.rb, line 37
def self.parse(input)
  if key = parse_to_key(input)
    self.new key
  else
    raise InvalidInputError, "Display speed '#{input}' is invalid."
  end
end