Class: OpenHAB::Core::Items::Metadata::Provider

Inherits:
Provider show all
Defined in:
lib/openhab/core/items/metadata/provider.rb

Overview

Provides metadata created in Ruby to openHAB

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Provider

#[], #all, current, #inspect

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

.registryorg.openhab.core.items.MetadataRegistry

The Metadata registry



19
20
21
# File 'lib/openhab/core/items/metadata/provider.rb', line 19

def registry
  @registry ||= OSGi.service("org.openhab.core.items.MetadataRegistry")
end

Instance Method Details

#remove_item_metadata(item_name) ⇒ void Also known as: removeItemMetadata

This method returns an undefined value.

Removes all metadata of a given item.

Parameters:

  • item_name (String)


34
35
36
37
38
39
40
41
42
# File 'lib/openhab/core/items/metadata/provider.rb', line 34

def remove_item_metadata(item_name)
  @elements.delete_if do |_k, v|
    next unless v.uid.item_name == item_name

    notify_listeners_about_removed_element(v)
    true
  end
  nil
end