Class: TivoHMO::Adapters::Settings::SetValueItem
- Inherits:
-
Object
- Object
- TivoHMO::Adapters::Settings::SetValueItem
- Includes:
- GemLogger::LoggerSupport, MonitorMixin, TivoHMO::API::Item
- Defined in:
- lib/tivohmo/adapters/settings/set_value_item.rb
Overview
An Item for toggling boolean bvalue
Instance Attribute Summary
Attributes included from TivoHMO::API::Item
Attributes included from TivoHMO::API::Node
#app, #children, #content_type, #created_at, #identifier, #modified_at, #parent, #root, #source_format, #title
Instance Method Summary collapse
-
#initialize(key, new_value) ⇒ SetValueItem
constructor
A new instance of SetValueItem.
- #metadata ⇒ Object
Methods included from TivoHMO::API::Item
Methods included from TivoHMO::API::Node
#add_child, #app?, #find, #root?, #title_path, #to_s, #tree_string
Constructor Details
#initialize(key, new_value) ⇒ SetValueItem
Returns a new instance of SetValueItem.
14 15 16 17 18 |
# File 'lib/tivohmo/adapters/settings/set_value_item.rb', line 14 def initialize(key, new_value) super(key) @new_value = new_value self.title = "Set value to #{new_value}" end |
Instance Method Details
#metadata ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/tivohmo/adapters/settings/set_value_item.rb', line 20 def md = super md.description = "Value has now been set to #{@new_value}, hit back to return" md.item_detail_callback = Proc.new do logger.info("Setting #{identifier} to: #{@new_value}") Config.instance.set(identifier, @new_value) parent.children.clear end md end |