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.
Constant Summary
Constants included from OpenHAB::DSL
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, #channels, #dimension, #format, #groups, #icon, #label, #metadata, #name, #state, #tags, #type
Instance Method Summary collapse
-
#initialize(*args, type: nil, function: nil, thing: nil, **kwargs) ⇒ 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 OpenHAB::DSL
after, between, config_description, debounce_for, ensure_states, ensure_states!, holiday_file, holiday_file!, items, only_every, persistence, persistence!, profile, provider, provider!, rule, rule!, rules, scene, scene!, script, script!, shared_cache, sitemaps, store_states, things, throttle_for, timers, transform, unit, unit!
Methods included from Rules::Terse
#changed, #channel, #channel_linked, #channel_unlinked, #cron, #every, #item_added, #item_removed, #item_updated, #on_start, #received_command, #thing_added, #thing_removed, #thing_updated, #updated
Methods included from Core::ScriptHandling
script_loaded, script_unloaded
Methods included from Core::Actions
Methods included from Core::EntityLookup
#items, #method_missing, #things
Methods inherited from ItemBuilder
#alexa, #channel, #expire, #ga, #group, #homekit, #inspect, #tag, #to_s
Constructor Details
#initialize(*args, type: nil, function: nil, thing: nil, **kwargs) ⇒ GroupItemBuilder
Returns a new instance of GroupItemBuilder.
675 676 677 678 679 680 681 682 |
# File 'lib/openhab/dsl/items/builder.rb', line 675 def initialize(*args, type: nil, function: nil, thing: nil, **kwargs) raise ArgumentError, "invalid function #{function}" if function && !function.match?(FUNCTION_REGEX) super(type, *args, **kwargs) @function = function @members = [] @thing = thing end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class OpenHAB::DSL
Instance Attribute Details
#function ⇒ String?
The combiner function for this group
656 657 658 |
# File 'lib/openhab/dsl/items/builder.rb', line 656 def function @function end |
#label_base ⇒ String?
A prefix to be added to the label of any member items
665 666 667 |
# File 'lib/openhab/dsl/items/builder.rb', line 665 def label_base @label_base end |
#members ⇒ Array<ItemBuilder> (readonly)
Members to be created in this group
668 669 670 |
# File 'lib/openhab/dsl/items/builder.rb', line 668 def members @members end |
#name_base ⇒ String?
A prefix to be added to the name of any member items
662 663 664 |
# File 'lib/openhab/dsl/items/builder.rb', line 662 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
659 660 661 |
# File 'lib/openhab/dsl/items/builder.rb', line 659 def thing @thing end |
#unit ⇒ String? (readonly)
Unit (for number items only)
Due to ItemBuilder#format inference, setting the unit is cross-compatible with openHAB 3.4 and 4.0.
637 638 639 |
# File 'lib/openhab/dsl/items/builder.rb', line 637 def unit @unit end |