openhab-scripting 5.44.1 → 5.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/lib/openhab/core/actions/notification.rb +11 -14
  3. data/lib/openhab/core/actions/transformation.rb +1 -1
  4. data/lib/openhab/core/actions/voice.rb +1 -1
  5. data/lib/openhab/core/actions.rb +2 -2
  6. data/lib/openhab/core/entity_lookup.rb +2 -2
  7. data/lib/openhab/core/events/item_state_changed_event.rb +2 -3
  8. data/lib/openhab/core/gem.rb +17 -0
  9. data/lib/openhab/core/items/persistence.rb +10 -40
  10. data/lib/openhab/core/items/registry.rb +2 -2
  11. data/lib/openhab/core/items/semantics/enumerable.rb +4 -4
  12. data/lib/openhab/core/items/semantics.rb +0 -6
  13. data/lib/openhab/core/items.rb +5 -5
  14. data/lib/openhab/core/lazy_array.rb +2 -2
  15. data/lib/openhab/core/things/registry.rb +2 -2
  16. data/lib/openhab/core/types/date_time_type.rb +10 -34
  17. data/lib/openhab/core/types/hsb_type.rb +2 -2
  18. data/lib/openhab/core/types.rb +29 -29
  19. data/lib/openhab/core.rb +8 -2
  20. data/lib/openhab/core_ext/java/duration.rb +1 -1
  21. data/lib/openhab/core_ext/java/list.rb +4 -4
  22. data/lib/openhab/core_ext/ruby/symbol.rb +1 -1
  23. data/lib/openhab/dsl/config_description/builder.rb +24 -20
  24. data/lib/openhab/dsl/items/builder.rb +7 -7
  25. data/lib/openhab/dsl/items/timed_command.rb +5 -5
  26. data/lib/openhab/dsl/rules/triggers/conditions/duration.rb +3 -3
  27. data/lib/openhab/dsl/sitemaps/builder.rb +40 -65
  28. data/lib/openhab/dsl/things/builder.rb +8 -8
  29. data/lib/openhab/dsl/timer_manager.rb +0 -1
  30. data/lib/openhab/dsl/version.rb +1 -1
  31. data/lib/openhab/dsl.rb +21 -21
  32. data/lib/openhab/rspec/helpers.rb +11 -13
  33. data/lib/openhab/rspec/karaf.rb +4 -4
  34. data/lib/openhab/rspec/mocks/timer.rb +2 -2
  35. metadata +32 -5
@@ -95,8 +95,8 @@ module OpenHAB
95
95
  # @param (see GroupItemBuilder#initialize)
96
96
  # @yieldparam [GroupItemBuilder] builder Item for further customization
97
97
  # @return [GroupItem]
98
- def group_item(*args, **kwargs, &block)
99
- item = GroupItemBuilder.new(*args, provider:, **kwargs)
98
+ def group_item(*, **, &block)
99
+ item = GroupItemBuilder.new(*, provider:, **)
100
100
  item.instance_eval(&block) if block
101
101
  result = provider.add(item)
102
102
  item.members.each do |i|
@@ -107,8 +107,8 @@ module OpenHAB
107
107
 
108
108
  private
109
109
 
110
- def item(*args, **kwargs, &block)
111
- item = ItemBuilder.new(*args, provider:, **kwargs)
110
+ def item(*, **, &block)
111
+ item = ItemBuilder.new(*, provider:, **)
112
112
  item.instance_eval(&block) if block
113
113
  r = provider.add(item)
114
114
  return Core::Items::Proxy.new(r) if r.is_a?(Item)
@@ -152,7 +152,7 @@ module OpenHAB
152
152
  item.metadata
153
153
  .reject { |namespace, _| builder.metadata.key?(namespace) }
154
154
  .each do |namespace, metadata|
155
- item.metadata.delete(namespace) if metadata.provider == Core::Items::Metadata::Provider.current
155
+ item.metadata.delete(namespace) if metadata.provider == Core::Items::Metadata::Provider.current
156
156
  end
157
157
  else
158
158
  item = builder.build
@@ -803,10 +803,10 @@ module OpenHAB
803
803
  # @param thing [Core::Things::ThingUID, Core::Things::Thing, String, nil]
804
804
  # A Thing to be used as the base for the channel for any contained items.
805
805
  # @param (see ItemBuilder#initialize)
806
- def initialize(*args, type: nil, function: nil, thing: nil, **kwargs)
806
+ def initialize(*, type: nil, function: nil, thing: nil, **)
807
807
  raise ArgumentError, "invalid function #{function}" if function && !function.match?(FUNCTION_REGEX)
808
808
 
809
- super(type, *args, **kwargs)
809
+ super(type, *, **)
810
810
  @function = function
811
811
  @members = []
812
812
  @thing = thing
@@ -149,9 +149,9 @@ module OpenHAB
149
149
  # end
150
150
  # end
151
151
  #
152
- def command(command, for: nil, on_expire: nil, only_when_ensured: false, **kwargs, &block)
152
+ def command(command, for: nil, on_expire: nil, only_when_ensured: false, **, &block)
153
153
  duration = binding.local_variable_get(:for)
154
- return super(command, **kwargs) unless duration
154
+ return super(command, **) unless duration
155
155
 
156
156
  on_expire = block if block
157
157
 
@@ -159,10 +159,10 @@ module OpenHAB
159
159
  on_expire ||= default_on_expire(command)
160
160
  if only_when_ensured
161
161
  DSL.ensure_states do
162
- create_timed_command(command, duration:, on_expire:) if super(command, **kwargs)
162
+ create_timed_command(command, duration:, on_expire:) if super(command, **)
163
163
  end
164
164
  else
165
- super(command, **kwargs)
165
+ super(command, **)
166
166
  create_timed_command(command, duration:, on_expire:)
167
167
  end
168
168
  end
@@ -185,7 +185,7 @@ module OpenHAB
185
185
  timed_command_details.timer.reschedule(duration)
186
186
  # disable the cancel rule while we send the new command
187
187
  DSL.rules[timed_command_details.rule_uid].disable
188
- super(command, **kwargs) # This returns nil when "ensured"
188
+ super(command, **) # This returns nil when "ensured"
189
189
  DSL.rules[timed_command_details.rule_uid].enable
190
190
  timed_command_details
191
191
  end
@@ -31,16 +31,16 @@ module OpenHAB
31
31
  # Process rule
32
32
  # @param [Hash] inputs inputs from trigger
33
33
  #
34
- def process(mod:, inputs:, &block)
34
+ def process(mod:, inputs:, &)
35
35
  timer = @timers[inputs["triggeringItem"]&.name]
36
36
  if timer&.active?
37
- process_active_timer(timer, inputs, mod, &block)
37
+ process_active_timer(timer, inputs, mod, &)
38
38
  elsif @conditions.process(mod:, inputs:)
39
39
  logger.trace { "Trigger Guards Matched for #{self}, delaying rule execution" }
40
40
  # Add timer and attach timer to delay object, and also state being tracked to so
41
41
  # timer can be cancelled if state changes
42
42
  # Also another timer should not be created if changed to same value again but instead rescheduled
43
- create_trigger_delay_timer(inputs, mod, &block)
43
+ create_trigger_delay_timer(inputs, mod, &)
44
44
  else
45
45
  logger.trace { "Trigger Guards did not match for #{self}, ignoring trigger." }
46
46
  end
@@ -48,8 +48,8 @@ module OpenHAB
48
48
  # @yield Block executed in the context of a {SitemapBuilder}
49
49
  # @return [SitemapBuilder]
50
50
  # @!visibility public
51
- def sitemap(name, label: nil, icon: nil, &block)
52
- sitemap = SitemapBuilder.new(name, @builder_proxy, label:, icon:, &block)
51
+ def sitemap(name, label: nil, icon: nil, &)
52
+ sitemap = SitemapBuilder.new(name, @builder_proxy, label:, icon:, &)
53
53
  sitemap = sitemap.build
54
54
  if @update && @provider.get(sitemap.uid)
55
55
  @provider.update(sitemap)
@@ -355,8 +355,8 @@ module OpenHAB
355
355
  # @!method initialize(item: nil, label: nil, icon: nil, static_icon: nil, mappings: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil)
356
356
  # @param mappings [Hash, Array, nil] Mappings from command to label (see {SwitchBuilder#mappings})
357
357
  # @!visibility private
358
- def initialize(type, builder_proxy, mappings: nil, **kwargs, &block)
359
- super(type, builder_proxy, **kwargs, &block)
358
+ def initialize(type, builder_proxy, mappings: nil, **, &)
359
+ super(type, builder_proxy, **, &)
360
360
 
361
361
  @mappings = mappings
362
362
  end
@@ -370,8 +370,7 @@ module OpenHAB
370
370
  mapping.cmd = cmd.to_s
371
371
  mapping.release_cmd = release_cmd.to_s unless release_cmd.nil?
372
372
  mapping.label = label&.to_s || cmd.to_s
373
- # @deprecated OH 4.1 the if check is not needed in OH4.1+
374
- mapping.icon = icon if icon
373
+ mapping.icon = icon
375
374
  widget.mappings.add(mapping)
376
375
  end
377
376
  widget
@@ -400,8 +399,8 @@ module OpenHAB
400
399
  # @param range [Range, nil] Allowed range of the value (see {SetpointBuilder#range})
401
400
  # @param step [Numeric,nil] How far the value will change with each button press (see {SetpointBuilder#step})
402
401
  # @!visibility private
403
- def initialize(type, builder_proxy, range: nil, step: nil, **kwargs, &block)
404
- super(type, builder_proxy, **kwargs, &block)
402
+ def initialize(type, builder_proxy, range: nil, step: nil, **, &)
403
+ super(type, builder_proxy, **, &)
405
404
 
406
405
  @range = range
407
406
  @step = step
@@ -441,8 +440,8 @@ module OpenHAB
441
440
  # @param release_only [true, false, nil]
442
441
  # Only send the command when the slider is released (see {SliderBuilder#release_only=})
443
442
  # @!visibility private
444
- def initialize(type, builder_proxy, switch: nil, frequency: nil, release_only: nil, **kwargs, &block)
445
- super(type, builder_proxy, **kwargs, &block)
443
+ def initialize(type, builder_proxy, switch: nil, frequency: nil, release_only: nil, **, &)
444
+ super(type, builder_proxy, **, &)
446
445
 
447
446
  @switch = switch
448
447
  @frequency = frequency
@@ -464,8 +463,7 @@ module OpenHAB
464
463
  widget = super
465
464
  widget.switch_enabled = switch? unless @switch.nil?
466
465
  widget.send_frequency = (frequency * 1000).to_i if frequency
467
- # @deprecated OH 4.1 remove the version check when dropping OH 4.1 support
468
- widget.release_only = release_only? if OpenHAB::Core.version >= OpenHAB::Core::V4_2 && !@release_only.nil?
466
+ widget.release_only = release_only? unless @release_only.nil?
469
467
  widget
470
468
  end
471
469
  end
@@ -487,8 +485,8 @@ module OpenHAB
487
485
  # @param [String, nil] url (see {VideoBuilder#url})
488
486
  # @param [:mjpeg, :hls, nil] encoding (see {VideoBuilder#encoding})
489
487
  # @!visibility private
490
- def initialize(type, builder_proxy, url: nil, encoding: nil, **kwargs, &block)
491
- super(type, builder_proxy, **kwargs, &block)
488
+ def initialize(type, builder_proxy, url: nil, encoding: nil, **, &)
489
+ super(type, builder_proxy, **, &)
492
490
 
493
491
  @url = url
494
492
  self.encoding = encoding
@@ -563,9 +561,9 @@ module OpenHAB
563
561
  legend: nil,
564
562
  group: nil,
565
563
  y_axis_pattern: nil,
566
- **kwargs,
567
- &block)
568
- super(type, builder_proxy, **kwargs, &block)
564
+ **,
565
+ &)
566
+ super(type, builder_proxy, **, &)
569
567
 
570
568
  @service = service
571
569
  self.refresh = refresh
@@ -615,8 +613,8 @@ module OpenHAB
615
613
  # @!method initialize(item: nil, label: nil, icon: nil, static_icon: nil, height: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil)
616
614
  # @param height [Integer] The number of element rows to fill (see {DefaultBuilder#height})
617
615
  # @!visibility private
618
- def initialize(type, builder_proxy, height: nil, **kwargs, &block)
619
- super(type, builder_proxy, **kwargs, &block)
616
+ def initialize(type, builder_proxy, height: nil, **, &)
617
+ super(type, builder_proxy, **, &)
620
618
 
621
619
  @height = height
622
620
  end
@@ -640,8 +638,8 @@ module OpenHAB
640
638
  # @!method initialize(item: nil, label: nil, icon: nil, static_icon: nil, url: nil, height: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil)
641
639
  # @param url [String, nil] (see {WebviewBuilder#url})
642
640
  # @!visibility private
643
- def initialize(type, builder_proxy, url: nil, **kwargs, &block)
644
- super(type, builder_proxy, **kwargs, &block)
641
+ def initialize(type, builder_proxy, url: nil, **, &)
642
+ super(type, builder_proxy, **, &)
645
643
 
646
644
  @url = url
647
645
  end
@@ -666,8 +664,8 @@ module OpenHAB
666
664
  # @!method initialize(item: nil, label: nil, icon: nil, static_icon: nil, frequency: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil)
667
665
  # @param frequency [Numeric, nil] How often to send requests (see {ColorpickerBuilder#frequency})
668
666
  # @!visibility private
669
- def initialize(type, builder_proxy, frequency: nil, **kwargs, &block)
670
- super(type, builder_proxy, **kwargs, &block)
667
+ def initialize(type, builder_proxy, frequency: nil, **, &)
668
+ super(type, builder_proxy, **, &)
671
669
 
672
670
  @frequency = frequency
673
671
  end
@@ -692,8 +690,8 @@ module OpenHAB
692
690
  # @!method initialize(item: nil, label: nil, icon: nil, static_icon: nil, range: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil)
693
691
  # @param range [Range, nil] Allowed range of the value (see {ColortemperaturepickerBuilder#range})
694
692
  # @!visibility private
695
- def initialize(type, builder_proxy, range: nil, **kwargs, &block)
696
- super(type, builder_proxy, **kwargs, &block)
693
+ def initialize(type, builder_proxy, range: nil, **, &)
694
+ super(type, builder_proxy, **, &)
697
695
 
698
696
  @range = range
699
697
  end
@@ -729,8 +727,8 @@ module OpenHAB
729
727
  # @param [:text, :number, :date, :time, :datetime, nil] hint
730
728
  # Gives a hint to the user interface to use a widget adapted to a specific use (see {InputBuilder#hint})
731
729
  # @!visibility private
732
- def initialize(type, builder_proxy, hint: nil, **kwargs, &block)
733
- super(type, builder_proxy, **kwargs, &block)
730
+ def initialize(type, builder_proxy, hint: nil, **, &)
731
+ super(type, builder_proxy, **, &)
734
732
 
735
733
  self.hint = hint
736
734
  end
@@ -798,9 +796,9 @@ module OpenHAB
798
796
  click:,
799
797
  release: nil,
800
798
  stateless: nil,
801
- **kwargs,
802
- &block)
803
- super(:button, builder_proxy, **kwargs, &block)
799
+ **,
800
+ &)
801
+ super(:button, builder_proxy, **, &)
804
802
 
805
803
  @row = row
806
804
  @column = column
@@ -816,24 +814,12 @@ module OpenHAB
816
814
 
817
815
  # @!visibility private
818
816
  def build
819
- if Core.version >= Core::V4_2
820
- super.tap do |widget|
821
- widget.row = row
822
- widget.column = column
823
- widget.cmd = click.to_s
824
- widget.release_cmd = release.to_s unless release.nil?
825
- widget.stateless = stateless? unless @stateless.nil?
826
- end
827
- else
828
- # @deprecated OH 4.1
829
- # in OH 4.1, the button is a property of the Buttongrid, not a widget
830
- SitemapBuilder.factory.create_button.tap do |button|
831
- button.row = row
832
- button.column = column
833
- button.cmd = click.to_s
834
- button.label = label
835
- button.icon = icon if icon
836
- end
817
+ super.tap do |widget|
818
+ widget.row = row
819
+ widget.column = column
820
+ widget.cmd = click.to_s
821
+ widget.release_cmd = release.to_s unless release.nil?
822
+ widget.stateless = stateless? unless @stateless.nil?
837
823
  end
838
824
  end
839
825
  end
@@ -1220,8 +1206,8 @@ module OpenHAB
1220
1206
  # @param url [String, nil] The URL for the image (see {ImageBuilder#url})
1221
1207
  # @param refresh [Numeric, nil] How often to refresh the image (see {ImageBuilder#refresh})
1222
1208
  # @!visibility private
1223
- def initialize(type, builder_proxy, url: nil, refresh: nil, **kwargs, &block)
1224
- super(type, builder_proxy, **kwargs, &block)
1209
+ def initialize(type, builder_proxy, url: nil, refresh: nil, **, &)
1210
+ super(type, builder_proxy, **, &)
1225
1211
 
1226
1212
  @url = url
1227
1213
  @refresh = refresh
@@ -1250,17 +1236,6 @@ module OpenHAB
1250
1236
  REQUIRED_BUTTON_ARGS = %i[row column click].freeze
1251
1237
  private_constant :REQUIRED_BUTTON_ARGS
1252
1238
 
1253
- # @deprecated OH 4.1 in OH 4.1, Buttongrid is not a LinkableWidget.
1254
- # Pretend that the buttons property is its children so we can add to it in LinkableWidgetBuilder#build
1255
- if (Core::V4_1...Core::V4_2).cover?(Core.version)
1256
- java_import org.openhab.core.model.sitemap.sitemap.Buttongrid
1257
- module Buttongrid
1258
- def children
1259
- buttons
1260
- end
1261
- end
1262
- end
1263
-
1264
1239
  # (see WidgetBuilder#initialize)
1265
1240
  # @!method initialize(item: nil, label: nil, icon: nil, static_icon: nil, buttons: nil, label_color: nil, value_color: nil, icon_color: nil, visibility: nil)
1266
1241
  # @param [Array<Array<int, int, Command, String, String>>] buttons An array of buttons to display.
@@ -1315,8 +1290,8 @@ module OpenHAB
1315
1290
  #
1316
1291
  # @see https://www.openhab.org/docs/ui/sitemaps.html#element-type-buttongrid
1317
1292
  # @!visibility private
1318
- def initialize(type, builder_proxy, buttons: [], **kwargs, &block)
1319
- super(type, builder_proxy, **kwargs, &block)
1293
+ def initialize(type, builder_proxy, buttons: [], **, &)
1294
+ super(type, builder_proxy, **, &)
1320
1295
 
1321
1296
  # Put the buttons given in the constructor before those added in the block
1322
1297
  # We can't do this before calling the super constructor because `children` is initialized there
@@ -1423,7 +1398,7 @@ module OpenHAB
1423
1398
  # end
1424
1399
  # end
1425
1400
  #
1426
- def button(row = nil, column = nil, click = nil, label = nil, icon = nil, **kwargs, &block)
1401
+ def button(row = nil, column = nil, click = nil, label = nil, icon = nil, **kwargs, &)
1427
1402
  args = [row, column, click, label, icon].compact
1428
1403
 
1429
1404
  args = args.first if args.first.is_a?(Array)
@@ -1439,7 +1414,7 @@ module OpenHAB
1439
1414
  kwargs[:item] ||= item if item # default to the buttongrid's item
1440
1415
  kwargs[:label] ||= kwargs[:click].to_s
1441
1416
 
1442
- ButtonBuilder.new(@builder_proxy, **kwargs, &block).tap do |b|
1417
+ ButtonBuilder.new(@builder_proxy, **kwargs, &).tap do |b|
1443
1418
  children << b
1444
1419
  end
1445
1420
  end
@@ -89,8 +89,8 @@ module OpenHAB
89
89
 
90
90
  private
91
91
 
92
- def build(klass, *args, **kwargs, &block)
93
- builder = klass.new(*args, **kwargs)
92
+ def build(klass, *, **, &block)
93
+ builder = klass.new(*, **)
94
94
  builder.parent_builder = self if builder.respond_to?(:parent_builder=)
95
95
  builder.instance_eval(&block) if block
96
96
  thing = builder.build
@@ -227,8 +227,8 @@ module OpenHAB
227
227
  # Add an explicitly configured channel to this item
228
228
  # @see ChannelBuilder#initialize
229
229
  # @return [Core::Things::Channel]
230
- def channel(*args, **kwargs, &block)
231
- channel = ChannelBuilder.new(*args, thing: self, **kwargs)
230
+ def channel(*, **, &block)
231
+ channel = ChannelBuilder.new(*, thing: self, **)
232
232
  channel.instance_eval(&block) if block
233
233
  channel.build.tap { |c| @channels << c }
234
234
  end
@@ -287,14 +287,14 @@ module OpenHAB
287
287
 
288
288
  # Create a new Bridge with this Bridge as its Bridge
289
289
  # @see BridgeBuilder#initialize
290
- def bridge(*args, **kwargs, &)
291
- parent_builder.bridge(*args, bridge: self, **kwargs, &)
290
+ def bridge(*, **, &)
291
+ parent_builder.bridge(*, bridge: self, **, &)
292
292
  end
293
293
 
294
294
  # Create a new Thing with this Bridge as its Bridge
295
295
  # @see ThingBuilder#initialize
296
- def thing(*args, **kwargs, &)
297
- parent_builder.thing(*args, bridge: self, **kwargs, &)
296
+ def thing(*, **, &)
297
+ parent_builder.thing(*, bridge: self, **, &)
298
298
  end
299
299
  end
300
300
 
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "set"
4
3
  require "singleton"
5
4
 
6
5
  module OpenHAB
@@ -4,6 +4,6 @@ module OpenHAB
4
4
  module DSL
5
5
  # Version of openHAB helper libraries
6
6
  # @return [String]
7
- VERSION = "5.44.1"
7
+ VERSION = "5.46.0"
8
8
  end
9
9
  end
data/lib/openhab/dsl.rb CHANGED
@@ -86,39 +86,39 @@ module OpenHAB
86
86
  # @!group Rule Creation
87
87
 
88
88
  # (see Rules::Builder#rule)
89
- def rule(name = nil, id: nil, **kwargs, &block)
90
- rules.build { rule(name, id:, **kwargs, &block) }
89
+ def rule(name = nil, id: nil, **, &)
90
+ rules.build { rule(name, id:, **, &) }
91
91
  end
92
92
 
93
93
  # Creates a rule that will remove existing rules with the same id, even when the id has been inferred.
94
94
  # @see rule
95
- def rule!(name = nil, id: nil, **kwargs, &block)
96
- rules.build { rule(name, id:, replace: true, **kwargs, &block) }
95
+ def rule!(name = nil, id: nil, **, &)
96
+ rules.build { rule(name, id:, replace: true, **, &) }
97
97
  end
98
98
 
99
99
  # (see Rules::Builder#scene)
100
- def scene(name = nil, description: nil, id: nil, tag: nil, tags: nil, **kwargs, &block)
101
- rules.build { scene(name, description:, id:, tag:, tags:, **kwargs, &block) }
100
+ def scene(name = nil, description: nil, id: nil, tag: nil, tags: nil, **, &)
101
+ rules.build { scene(name, description:, id:, tag:, tags:, **, &) }
102
102
  end
103
103
 
104
104
  # Creates a scene that will remove existing rules/scenes with the same id, even when the id has been inferred.
105
105
  # @see scene
106
- def scene!(name = nil, description: nil, id: nil, tag: nil, tags: nil, **kwargs, &block)
106
+ def scene!(name = nil, description: nil, id: nil, tag: nil, tags: nil, **, &)
107
107
  rules.build do
108
- scene(name, description:, id:, tag:, tags:, replace: true, **kwargs, &block)
108
+ scene(name, description:, id:, tag:, tags:, replace: true, **, &)
109
109
  end
110
110
  end
111
111
 
112
112
  # (see Rules::Builder#script)
113
- def script(name = nil, description: nil, id: nil, tag: nil, tags: nil, **kwargs, &block)
114
- rules.build { script(name, description:, id:, tag:, tags:, **kwargs, &block) }
113
+ def script(name = nil, description: nil, id: nil, tag: nil, tags: nil, **, &)
114
+ rules.build { script(name, description:, id:, tag:, tags:, **, &) }
115
115
  end
116
116
 
117
117
  # Creates a script that will remove existing rules/scripts with the same id, even when the id has been inferred.
118
118
  # @see script
119
- def script!(name = nil, description: nil, id: nil, tag: nil, tags: nil, **kwargs, &block)
119
+ def script!(name = nil, description: nil, id: nil, tag: nil, tags: nil, **, &)
120
120
  rules.build do
121
- script(name, description:, id:, tag:, tags:, replace: true, **kwargs, &block)
121
+ script(name, description:, id:, tag:, tags:, replace: true, **, &)
122
122
  end
123
123
  end
124
124
 
@@ -519,7 +519,7 @@ module OpenHAB
519
519
  #
520
520
  # @param (see Rules::BuilderDSL#debounce_for)
521
521
  # @param [Object] id ID to associate with this call.
522
- # @param [Block] block The block to be debounced.
522
+ # @yield The block to be debounced.
523
523
  #
524
524
  # @return [void]
525
525
  #
@@ -536,9 +536,9 @@ module OpenHAB
536
536
  #
537
537
  # @see Rules::BuilderDSL#debounce_for Rule builder's debounce_for for a detailed description
538
538
  #
539
- def debounce_for(debounce_time, id: nil, &block)
539
+ def debounce_for(debounce_time, id: nil, &)
540
540
  idle_time = debounce_time.is_a?(Range) ? debounce_time.begin : debounce_time
541
- debounce(for: debounce_time, idle_time:, id:, &block)
541
+ debounce(for: debounce_time, idle_time:, id:, &)
542
542
  end
543
543
 
544
544
  #
@@ -562,15 +562,15 @@ module OpenHAB
562
562
  #
563
563
  # @param (see Rules::BuilderDSL#throttle_for)
564
564
  # @param [Object] id ID to associate with this call.
565
- # @param [Block] block The block to be throttled.
565
+ # @yield The block to be throttled.
566
566
  #
567
567
  # @return [void]
568
568
  #
569
569
  # @see Rules::BuilderDSL#debounce_for Rule builder's debounce_for for a detailed description
570
570
  # @see Rules::BuilderDSL#throttle_for
571
571
  #
572
- def throttle_for(duration, id: nil, &block)
573
- debounce(for: duration, id:, &block)
572
+ def throttle_for(duration, id: nil, &)
573
+ debounce(for: duration, id:, &)
574
574
  end
575
575
 
576
576
  # (see Core::Actions::Transformation.transform)
@@ -587,7 +587,7 @@ module OpenHAB
587
587
  #
588
588
  # @param (see Rules::BuilderDSL#only_every)
589
589
  # @param [Object] id ID to associate with this call.
590
- # @param [Block] block The block to be throttled.
590
+ # @yield The block to be throttled.
591
591
  #
592
592
  # @return [void]
593
593
  #
@@ -599,9 +599,9 @@ module OpenHAB
599
599
  # @see Rules::BuilderDSL#debounce_for Rule builder's debounce_for for a detailed description
600
600
  # @see Rules::BuilderDSL#only_every
601
601
  #
602
- def only_every(interval, id: nil, &block)
602
+ def only_every(interval, id: nil, &)
603
603
  interval = 1.send(interval) if %i[second minute hour day].include?(interval)
604
- debounce(for: interval, leading: true, id:, &block)
604
+ debounce(for: interval, leading: true, id:, &)
605
605
  end
606
606
 
607
607
  #
@@ -201,7 +201,7 @@ module OpenHAB
201
201
  .split(File::PATH_SEPARATOR)
202
202
  .reject(&:empty?)
203
203
  .reject do |path|
204
- $LOAD_PATH.include?(path)
204
+ $LOAD_PATH.include?(path)
205
205
  end)
206
206
 
207
207
  requires = jrubyscripting_config&.get("require") || ""
@@ -268,20 +268,18 @@ module OpenHAB
268
268
  OSGi.service_component_classes(bundle)
269
269
  .select { |klass, _services| klass.ancestors.include?(ast.java_class) }
270
270
  .each do |klass, services|
271
- new_ast_klass = Class.new(ast)
272
- new_ast_klass.become_java!
273
- wrapped_storage_service = Mocks::AbstractStorageBasedTypeProviderWrappedStorageService
274
- .new(storage_service,
275
- new_ast_klass.java_class,
276
- klass)
277
- new_ast = new_ast_klass.new(wrapped_storage_service)
278
-
279
- services -= [klass.name]
280
- OSGi.register_service(new_ast, *services, bundle: ast_bundle)
271
+ new_ast_klass = Class.new(ast)
272
+ new_ast_klass.become_java!
273
+ wrapped_storage_service = Mocks::AbstractStorageBasedTypeProviderWrappedStorageService
274
+ .new(storage_service,
275
+ new_ast_klass.java_class,
276
+ klass)
277
+ new_ast = new_ast_klass.new(wrapped_storage_service)
278
+
279
+ services -= [klass.name]
280
+ OSGi.register_service(new_ast, *services, bundle: ast_bundle)
281
281
  end
282
282
  end
283
- rescue NameError
284
- # @deprecated OH 4.0
285
283
  end
286
284
 
287
285
  # RSpec additions
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "fileutils"
4
- require "set"
5
4
  require "shellwords"
6
5
  require "time"
7
6
 
@@ -160,11 +159,11 @@ module OpenHAB
160
159
  :karafEtc,
161
160
  :defaultStartLevel
162
161
  klass.class_eval do
163
- def send_private(method_name, *args)
162
+ def send_private(method_name, *)
164
163
  method_name = method_name.to_s
165
164
  method = self.class.java_class.declared_methods.find { |m| m.name == method_name }
166
165
  method.accessible = true
167
- method.invoke(self, *args)
166
+ method.invoke(self, *)
168
167
  end
169
168
 
170
169
  def launch_simple
@@ -786,7 +785,7 @@ module OpenHAB
786
785
 
787
786
  <blacklistedFeatures>
788
787
  <feature>openhab-runtime-ui</feature>
789
- <feature>openhab-core-ui*</feature>
788
+ <feature>openhab-core-ui</feature>
790
789
  <feature>openhab-misc-*</feature>
791
790
  <feature>openhab-persistence-*</feature>
792
791
  <feature>openhab-package-standard</feature>
@@ -807,6 +806,7 @@ module OpenHAB
807
806
  <f:feature>openhab-core-model-sitemap</f:feature>
808
807
  <f:feature>openhab-core-model-thing</f:feature>
809
808
  <f:feature>openhab-core-storage-json</f:feature>
809
+ <f:feature>openhab-core-ui-icon</f:feature>
810
810
  <f:feature>openhab-transport-http</f:feature>
811
811
  <f:feature prerequisite="true">wrapper</f:feature>
812
812
  <f:bundle>mvn:org.openhab.core.bundles/org.openhab.core.karaf/#{version}</f:bundle>
@@ -99,9 +99,9 @@ module OpenHAB
99
99
  # @!visibility private
100
100
  module ClassMethods
101
101
  # @!visibility private
102
- def new(*args, **kwargs)
102
+ def new(*, **)
103
103
  return super if self == Timer
104
- return Timer.new(*args, **kwargs) if Timer.mock_timers?
104
+ return Timer.new(*, **) if Timer.mock_timers?
105
105
 
106
106
  super
107
107
  end