Sha256: 97f34efb734f46edc450223259fb2ccca6ab8e8d1326a5aa5415a178fffd9013
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
require 'movingsign_api/commands/internal/pretty_keyable' module MovingsignApi # Text display mode speed sending class DisplaySpeed include PrettyKeyable # @!visibility private def self.display_speed(key, code) register(key, code) end # @!group Display speed constants # @!macro [attach] dm.display_speed # @!attribute [r] $1 # Display speed +:$1+ (protocol display speed +'$2'+) # @return [Symbol] +:$1+ display_speed :fastest, '1' display_speed :faster, '2' display_speed :normal, '3' display_speed :slow, '4' display_speed :slower, '5' # @!endgroup # @return [Symbol] Display speed constant, one of {#faster}, {#normal}, {#slow} attr_accessor :key def initialize(speed) @key = speed end # Parses the supplied input into a {DisplaySpeed} instance if possible # @raise InvalidInputError on invalid input # @return [DisplaySpeed] def self.parse(input) if key = parse_to_key(input) self.new key else raise InvalidInputError, "Display speed '#{input}' is invalid." end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
movingsign_api-0.0.2 | lib/movingsign_api/commands/internal/display_speed.rb |
movingsign_api-0.0.1 | lib/movingsign_api/commands/internal/display_speed.rb |