Class: OpenHAB::Core::Items::Metadata::NamespaceHash

Inherits:
Object
  • Object
show all
Includes:
EmulateHash
Defined in:
lib/openhab/core/items/metadata/namespace_hash.rb

Overview

NamespaceHash represents the full metadata for the item.

It implements the entire interface of Hash.

Keys are namespaces, values are always Hash, though assignment allows using a Hash, a String, a ::Hash, or an array of two items: [String, ::Hash].

All keys are converted to strings.

Instance Method Summary collapse

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!

Instance Method Details

#attached?true, false

Is this object attached to an actual Item?

Returns:

  • (true, false)


49
50
51
# File 'lib/openhab/core/items/metadata/namespace_hash.rb', line 49

def attached?
  @hash.nil?
end

#to_hash::Hash Also known as: to_h, to_map

Implicit conversion to Hash

Returns:

  • (::Hash)


60
61
62
# File 'lib/openhab/core/items/metadata/namespace_hash.rb', line 60

def to_hash
  each.to_h { |namespace, meta| [namespace, meta] }
end