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

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

Overview

Provides Items 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!

Constructor Details

#initializeProvider

Returns a new instance of Provider.



38
39
40
# File 'lib/openhab/core/items/provider.rb', line 38

def initialize
  super(unload_priority: 50)
end

Class Method Details

.registryorg.openhab.core.items.ItemRegistry

The Item registry



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

def registry
  $ir
end

Instance Method Details

#remove(item_name, recursive = false) ⇒ Item?

Remove an item from this provider

Parameters:

  • item_name (String)
  • recursive (true, false) (defaults to: false)

Returns:

  • (Item, nil)

    The removed item, if found.



30
31
32
33
34
35
36
# File 'lib/openhab/core/items/provider.rb', line 30

def remove(item_name, recursive = false) # rubocop:disable Style/OptionalBooleanParameter matches Java method
  return nil unless @elements.key?(item_name)

  item = super(item_name)
  item.members.each { |member| remove(member.name, true) } if recursive && item.is_a?(GroupItem)
  item
end