Class: MEACControl::Command::Generic
- Inherits:
-
Object
- Object
- MEACControl::Command::Generic
show all
- Defined in:
- lib/meac_control/command/generic.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
10
11
12
|
# File 'lib/meac_control/command/generic.rb', line 10
def command
@command
end
|
#value ⇒ Object
Returns the value of attribute value.
10
11
12
|
# File 'lib/meac_control/command/generic.rb', line 10
def value
@value
end
|
Class Method Details
.request ⇒ Object
12
13
14
|
# File 'lib/meac_control/command/generic.rb', line 12
def self.request
new.freeze
end
|
Instance Method Details
#command_set? ⇒ Boolean
27
28
29
|
# File 'lib/meac_control/command/generic.rb', line 27
def command_set?
(value.nil? or value.empty?) ? false : true
end
|
#hash_for(mode) ⇒ Object
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/meac_control/command/generic.rb', line 16
def hash_for(mode)
if mode == :set
raise MEACControl::Command::InvalidValue if (value.nil? or value.empty?)
{command.to_sym => value}
elsif mode == :get
{command.to_sym => '*'}
else
raise MEACControl::Command::InvalidMode
end
end
|