Module: OpenHAB::Core::Items::GroupFunction

Defined in:
lib/openhab/core/items/group_function.rb

Overview

Adds ‘#to_s` and `#inspect` to group function.

Examples:

# Group:SWITCH:OR(ON,OFF) Switches
logger.info "The Switches group function is: #{Switches.function}" # => "OR"
logger.info "The Switches group function: #{Switches.function.inspect}" # => "OR(ON,OFF)"

Instance Method Summary collapse

Instance Method Details

#inspectString

Returns the group function and its parameters as a string

Returns:

  • (String)


29
30
31
32
33
# File 'lib/openhab/core/items/group_function.rb', line 29

def inspect
  params = parameters.map(&:inspect).join(",")
  params = "(#{params})" unless params.empty?
  "#{self}#{params}"
end

#to_sString

Returns the group function as an uppercase string

Returns:

  • (String)


21
22
23
# File 'lib/openhab/core/items/group_function.rb', line 21

def to_s
  self.class.simple_name.upcase
end