openhab-scripting 4.38.0 → 4.39.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fb1294914e9c3e343bef8f0c1aaca327dbaa5875d446ec3e507edc1f390c9c9
|
4
|
+
data.tar.gz: be121541f849f733505c6180557f88fdd98869d89e0a593c6fc48db0e7e6daf5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6af3e7152dd02c9d98dea19f9bcaa4f474a20daac090941c1121705d177afec2498a2704462645d51b6e4e055efda1f0431702c0f7c6f126718b7994ef6baad
|
7
|
+
data.tar.gz: f9af8246710e44dc86719d10ba2577003293640e1c11885c054da9d23d0be8746e1103151c173672ddfab96ae218f5d717318ab72d628a194f7a243647ea885d
|
@@ -32,6 +32,11 @@ module Enumerable
|
|
32
32
|
each { |i| i.update(state) }
|
33
33
|
end
|
34
34
|
|
35
|
+
# Returns the group members the elements
|
36
|
+
def members
|
37
|
+
select { |e| e.respond_to? :members }.flat_map(&:members)
|
38
|
+
end
|
39
|
+
|
35
40
|
# @!method refresh
|
36
41
|
# Send the +REFRESH+ command to every item in the collection
|
37
42
|
|
@@ -76,4 +81,11 @@ module Enumerable
|
|
76
81
|
|
77
82
|
# @!method previous
|
78
83
|
# Send the +PREVIOUS+ command to every item in the collection
|
84
|
+
|
85
|
+
# @!visibility private
|
86
|
+
# can't use `include`, because Enumerable has already been included
|
87
|
+
# in other classes
|
88
|
+
def ensure
|
89
|
+
OpenHAB::DSL::Ensure::GenericItemDelegate.new(self)
|
90
|
+
end
|
79
91
|
end
|
@@ -148,8 +148,8 @@ module OpenHAB
|
|
148
148
|
# @example Search a Thermostat item for is setpoints
|
149
149
|
# eFamilyThermostat.points(Semantics::Control, Semantics::Temperature)
|
150
150
|
# # => [FamilyThermostat_HeatingSetpoint, FamilyThermostat_CoolingSetpoint]
|
151
|
-
# @example Given a A/V receiver's input item, search for
|
152
|
-
# FamilyReceiver_Input.points(Semantics::Switch) # => FamilyReceiver_Switch
|
151
|
+
# @example Given a A/V receiver's input item, search for its power item
|
152
|
+
# FamilyReceiver_Input.points(Semantics::Switch) # => [FamilyReceiver_Switch]
|
153
153
|
#
|
154
154
|
# @param [Class] point_or_property_types
|
155
155
|
# Pass 1 or 2 classes that are sub-classes of [Point] or [Property].
|
@@ -199,7 +199,7 @@ module Enumerable
|
|
199
199
|
# Returns a new array of items that are semantics points (optionally of a given type)
|
200
200
|
#
|
201
201
|
# @example Get all the power switch items for every equipment in a room
|
202
|
-
# lGreatRoom.equipments.
|
202
|
+
# lGreatRoom.equipments.points(Semantics::Switch)
|
203
203
|
def points(*point_or_property_types) # rubocop:disable Metrics
|
204
204
|
unless (0..2).cover?(point_or_property_types.length)
|
205
205
|
raise ArgumentError, "wrong number of arguments (given #{point_or_property_types.length}, expected 0..2)"
|
@@ -214,13 +214,27 @@ module Enumerable
|
|
214
214
|
raise ArgumentError, 'point_or_property_types cannot both be a subclass of Point or Property'
|
215
215
|
end
|
216
216
|
|
217
|
-
|
218
|
-
|
219
|
-
|
217
|
+
filter_with_members(&:point?)
|
218
|
+
.select do |point|
|
220
219
|
point_or_property_types.all? do |tag|
|
221
220
|
(tag < OpenHAB::DSL::Semantics::Point && point.point_type&.<=(tag)) ||
|
222
221
|
(tag < OpenHAB::DSL::Semantics::Property && point.property_type&.<=(tag))
|
223
222
|
end
|
224
223
|
end
|
225
224
|
end
|
225
|
+
|
226
|
+
#
|
227
|
+
# Select the elements where the given block returns true.
|
228
|
+
# If the block returns false but the element is a GroupItem with members,
|
229
|
+
# merge its members into the result and filter them using the same block
|
230
|
+
#
|
231
|
+
# @param [Block] &block A block that returns true for the elements and members to be included in the result
|
232
|
+
#
|
233
|
+
# @return [Array] The resulting array
|
234
|
+
#
|
235
|
+
# !@visibility private
|
236
|
+
def filter_with_members(&block)
|
237
|
+
selected, others = partition(&block)
|
238
|
+
others.members.select(&block).concat(selected)
|
239
|
+
end
|
226
240
|
end
|
data/lib/openhab/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openhab-scripting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.39.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian O'Connell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|