Class: MovingsignApi::AlignMode
- Inherits:
-
Object
- Object
- MovingsignApi::AlignMode
- Includes:
- PrettyKeyable
- Defined in:
- lib/movingsign_api/commands/internal/align_mode.rb
Overview
Align mode for a sign.
Valid values are:
-
:left
or ‘1’ -
:center
or ‘2’ -
:right
or ‘3
Align Mode Constants collapse
-
#center ⇒ Symbol
readonly
Align mode
:center
(protocol align mode ‘2’). -
#left ⇒ Symbol
readonly
Align mode
:left
(protocol align mode ‘1’). -
#right ⇒ Symbol
readonly
Align mode
:right
(protocol align mode ‘3’).
Instance Attribute Summary collapse
Class Method Summary collapse
-
.parse(input) ⇒ AlignMode
Parses an symbol or string into a valid AlignMode instance.
Instance Method Summary collapse
-
#initialize(key) ⇒ AlignMode
constructor
A new instance of AlignMode.
Constructor Details
#initialize(key) ⇒ AlignMode
Returns a new instance of AlignMode.
36 37 38 |
# File 'lib/movingsign_api/commands/internal/align_mode.rb', line 36 def initialize(key) @key = key end |
Instance Attribute Details
#center ⇒ Symbol (readonly)
Align mode :center
(protocol align mode ‘2’)
32 |
# File 'lib/movingsign_api/commands/internal/align_mode.rb', line 32 align_mode :center, '2' |
#key ⇒ Symbol
14 15 16 |
# File 'lib/movingsign_api/commands/internal/align_mode.rb', line 14 def key @key end |
#left ⇒ Symbol (readonly)
Align mode :left
(protocol align mode ‘1’)
30 |
# File 'lib/movingsign_api/commands/internal/align_mode.rb', line 30 align_mode :left, '1' |
#right ⇒ Symbol (readonly)
Align mode :right
(protocol align mode ‘3’)
31 |
# File 'lib/movingsign_api/commands/internal/align_mode.rb', line 31 align_mode :right, '3' |
Class Method Details
.parse(input) ⇒ AlignMode
Parses an symbol or string into a valid MovingsignApi::AlignMode instance
42 43 44 45 46 47 48 |
# File 'lib/movingsign_api/commands/internal/align_mode.rb', line 42 def self.parse(input) if key = parse_to_key(input) self.new key else raise InvalidInputError, "Align mode '#{input}' is invalid." end end |