Class: OpenHAB::Core::Types::StateDescription

Inherits:
Object
  • Object
show all
Defined in:
lib/openhab/core/types/state_description.rb

Overview

Describes restrictions of an item state and gives information how to interpret it

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optionsArray<org.openhab.core.types.StateOption> (readonly)



# File 'lib/openhab/core/types/state_description.rb', line 19

#patternString? (readonly)

Returns:

  • (String, nil)


# File 'lib/openhab/core/types/state_description.rb', line 13

#rangeRange? (readonly)

Returns:



24
25
26
27
28
# File 'lib/openhab/core/types/state_description.rb', line 24

def range
  return nil unless minimum || maximum

  minimum..maximum
end

#read_only?true, false (readonly)

Returns:

  • (true, false)


# File 'lib/openhab/core/types/state_description.rb', line 16

#stepBigDecimal? (readonly)

Returns:

  • (BigDecimal, nil)


# File 'lib/openhab/core/types/state_description.rb', line 10

Instance Method Details

#inspectString

Returns:

  • (String)


31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/openhab/core/types/state_description.rb', line 31

def inspect
  s = "#<OpenHAB::Core::Types::StateDescription"
  r = range
  s += " read_only" if read_only?
  s += " range=#{r}" if r
  s += " step=#{step}" if step
  s += " pattern=#{pattern.inspect}" if pattern && !pattern.empty?
  unless options.empty?
    s += " options=["
    options.each_with_index do |o, i|
      s += ", " if i != 0

      s += o.value.inspect

      s += " (#{o.label.inspect})" if o.value != o.label && !o.label.nil?
    end
    s += "]"
  end
  "#{s}>"
end