Class: RubyHome::BaseValue
- Inherits:
-
Object
- Object
- RubyHome::BaseValue
show all
- Defined in:
- lib/ruby_home/hap/values/base_value.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(characteristic_template = nil, initial_value = nil) ⇒ BaseValue
Returns a new instance of BaseValue.
11
12
13
14
|
# File 'lib/ruby_home/hap/values/base_value.rb', line 11
def initialize(characteristic_template=nil, initial_value=nil)
@template = characteristic_template
@value = initial_value
end
|
Instance Attribute Details
#value ⇒ Object
16
17
18
|
# File 'lib/ruby_home/hap/values/base_value.rb', line 16
def value
@value || default
end
|
Class Method Details
.value_for_template(template) ⇒ Object
5
6
7
8
9
|
# File 'lib/ruby_home/hap/values/base_value.rb', line 5
def self.value_for_template(template)
return IdentifyValue if template.name == :identify
Object.const_get("::RubyHome::#{template.format.modulize}Value") || NullValue
end
|
Instance Method Details
#default ⇒ Object
20
21
22
|
# File 'lib/ruby_home/hap/values/base_value.rb', line 20
def default
raise NotImplementedError
end
|