Class: OpenHAB::Core::Items::ItemChannelLinks
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- OpenHAB::Core::Items::ItemChannelLinks
- Defined in:
- lib/openhab/core/items/item_channel_links.rb
Overview
A wrapper for OpenHAB::Core::Items::Item#links delegated to Set<org.openhab.core.thing.link.ItemChannelLink>.
Adds methods for clearing item's links to channels.
Instance Method Summary collapse
-
#clear ⇒ self
Removes all links to channels from managed link providers.
Instance Method Details
#clear ⇒ self
Removes all links to channels from managed link providers.
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/openhab/core/items/item_channel_links.rb', line 28 def clear Things::Links::Provider.registry.all.each do |link| next unless link.item_name == @item.name provider = Things::Links::Provider.registry.provider_for(link.uid) if provider.is_a?(ManagedProvider) provider.remove(link.uid) else logger.warn("Cannot remove the link #{link.uid} from non-managed provider #{provider.inspect}") end end self end |