Class: OpenHAB::Core::Things::Links::Provider
- Defined in:
- lib/openhab/core/things/links/provider.rb
Overview
Class Method Summary collapse
-
.registry ⇒ org.openhab.core.thing.link.ItemChannelLinkRegistry
The ItemChannelLink registry.
Instance Method Summary collapse
-
#remove_links_for_item(item_name) ⇒ Integer
(also: #removeLinksForItem)
Removes all links to a given item.
-
#remove_links_for_thing(thing_uid) ⇒ Integer
(also: #removeLinksForThing)
Removes all links to a given thing.
Methods inherited from Provider
Methods included from Enumerable
#all_groups, #all_members, #command, #command!, #decrease, #down, #equipments, #fast_forward, #groups, #increase, #locations, #member_of, #members, #move, #next, #not_member_of, #not_tagged, #off, #on, #pause, #play, #points, #previous, #refresh, #rewind, #stop, #tagged, #toggle, #up, #update, #update!
Class Method Details
Instance Method Details
#remove_links_for_item(item_name) ⇒ Integer Also known as: removeLinksForItem
Removes all links to a given item.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/openhab/core/things/links/provider.rb', line 41 def remove_links_for_item(item_name) count = 0 @elements.delete_if do |_k, v| next unless v.item_name == item_name count += 1 notify_listeners_about_removed_element(v) true end count end |
#remove_links_for_thing(thing_uid) ⇒ Integer Also known as: removeLinksForThing
Removes all links to a given thing.
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/openhab/core/things/links/provider.rb', line 60 def remove_links_for_thing(thing_uid) count = 0 @elements.delete_if do |_k, v| next unless v.linked_uid.thing_uid == thing_uid count += 1 notify_listeners_about_removed_element(v) true end count end |