Class: OpenHAB::DSL::Items::GroupItemBuilder
- Inherits:
-
ItemBuilder
- Object
- ItemBuilder
- OpenHAB::DSL::Items::GroupItemBuilder
- Includes:
- Builder
- Defined in:
- lib/openhab/dsl/items/builder.rb
Overview
Allows customizing a group. You can also call any method from Builder, and those items will automatically be a member of this group.
Instance Attribute Summary collapse
-
#function ⇒ String?
The combiner function for this group.
-
#label_base ⇒ String?
A prefix to be added to the label of any member items.
-
#members ⇒ Array<ItemBuilder>
readonly
Members to be created in this group.
-
#name_base ⇒ String?
A prefix to be added to the name of any member items.
-
#thing ⇒ Core::Things::ThingUID, ...
A thing to be used as the base for the channel of any member items.
-
#unit ⇒ String?
readonly
Unit (for number items only).
Attributes inherited from ItemBuilder
#autoupdate, #command_options, #dimension, #format, #icon, #label, #metadata, #name, #range, #read_only, #state, #state_options, #step, #type
Instance Method Summary collapse
-
#initialize(type: nil, function: nil, thing: nil) ⇒ GroupItemBuilder
constructor
A new instance of GroupItemBuilder.
Methods included from Builder
#call_item, #color_item, #contact_item, #date_time_item, #dimmer_item, #group_item, #image_item, #location_item, #number_item, #player_item, #rollershutter_item, #string_item, #switch_item
Methods included from Core::EntityLookup
#items, #method_missing, #things
Methods inherited from ItemBuilder
#alexa, #channel, #expire, #ga, #group, #homekit, #inspect, #matter, #persist, #tag, #to_s
Constructor Details
#initialize(type: nil, function: nil, thing: nil) ⇒ GroupItemBuilder
Returns a new instance of GroupItemBuilder.
861 862 863 864 865 866 867 868 |
# File 'lib/openhab/dsl/items/builder.rb', line 861 def initialize(*, type: nil, function: nil, thing: nil, **) raise ArgumentError, "invalid function #{function}" if function && !function.match?(FUNCTION_REGEX) super(type, *, **) @function = function @members = [] @thing = thing end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class OpenHAB::Core::EntityLookup
Instance Attribute Details
#function ⇒ String?
The combiner function for this group
842 843 844 |
# File 'lib/openhab/dsl/items/builder.rb', line 842 def function @function end |
#label_base ⇒ String?
A prefix to be added to the label of any member items
851 852 853 |
# File 'lib/openhab/dsl/items/builder.rb', line 851 def label_base @label_base end |
#members ⇒ Array<ItemBuilder> (readonly)
Members to be created in this group
854 855 856 |
# File 'lib/openhab/dsl/items/builder.rb', line 854 def members @members end |
#name_base ⇒ String?
A prefix to be added to the name of any member items
848 849 850 |
# File 'lib/openhab/dsl/items/builder.rb', line 848 def name_base @name_base end |
#thing ⇒ Core::Things::ThingUID, ...
A thing to be used as the base for the channel of any member items
845 846 847 |
# File 'lib/openhab/dsl/items/builder.rb', line 845 def thing @thing end |
#unit ⇒ String? (readonly)
Unit (for number items only)
823 824 825 |
# File 'lib/openhab/dsl/items/builder.rb', line 823 def unit @unit end |