openhab-scripting 3.9.2 → 3.9.3

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: 56b3593e694d3bc367977cdd3514712c452977d4644cb59610e3e25e4c7e651b
4
- data.tar.gz: 0c45d6f6c9c4e493f7baca477e88cb8ec0ab3a3325fad60926d987875711ef62
3
+ metadata.gz: 5c03b915b3027b19b32190a109fd89168ff9d4fd2b636176f7f24b0efc2d39b0
4
+ data.tar.gz: 281990d13b27ef66090ba90f0413f1102ea3945fc4d8f356688ac38b663ea3c2
5
5
  SHA512:
6
- metadata.gz: 806e64e7bb07ff62fb8d99b3ad10505733340482b28c3c9e867b08fe0e40c2a43de586b56ca019cbc5b2408b57b4175c947e54d4020b20c6a8494791ab62cfc5
7
- data.tar.gz: 7285604ad3b6898441b7290143893d7488414ef91809b676639fb0ad100049305d15e48c95e1d6ad0afe4f98541d7c5e0f55070157b8675c5839cc2fe8b441fd
6
+ metadata.gz: 8531c1602708c55a29159ed8a82193040db66a21a23badeccf3eb960a6ac96dee573716de5e15f1d9b47d95bb4f563be87d54abf7ca7db17c30a104e954e295b
7
+ data.tar.gz: d880407cc64add80e583f99ba7b8220741b51894ab3479f2dafb63a7a30d9c539abaf2c96abacaa2cfbc8c8f64f6ad6679cc5f470fdeed12973af98eee65761c
@@ -129,7 +129,7 @@ module OpenHAB
129
129
  # Thing UIDs have at least 3 segements
130
130
  return if name.count('_') < 3
131
131
 
132
- name = name.gsub('_', ':')
132
+ name = name.tr('_', ':')
133
133
  # rubocop: disable Style/GlobalVars
134
134
  $things.get(Java::OrgOpenhabCoreThing::ThingUID.new(name))
135
135
  # rubocop: enable Style/GlobalVars
@@ -31,14 +31,14 @@ module OpenHAB
31
31
  # @param [Duration] duration Duration until timer should fire
32
32
  # @param [Block] block Block to execute when timer fires
33
33
  #
34
- def initialize(duration:, &block)
34
+ def initialize(duration:)
35
35
  @duration = duration
36
36
 
37
37
  # A semaphore is used to prevent a race condition in which calling the block from the timer thread
38
38
  # occurs before the @timer variable can be set resulting in @timer being nil
39
39
  semaphore = Mutex.new
40
40
 
41
- timer_block = proc { semaphore.synchronize { block.call(self) } }
41
+ timer_block = proc { semaphore.synchronize { yield(self) } }
42
42
 
43
43
  semaphore.synchronize do
44
44
  @timer = ScriptExecution.createTimer(
@@ -81,7 +81,7 @@ module OpenHAB
81
81
 
82
82
  case other
83
83
  when TimeOfDay::TimeOfDay, TimeOfDay::TimeOfDayRangeElement then to_tod <=> other
84
- when String then self <=> DateTime.parse(DATE_ONLY_REGEX =~ other ? "#{other}'T'00:00:00#{zone}" : other)
84
+ when String then self <=> DateTime.parse(DATE_ONLY_REGEX.match?(other) ? "#{other}'T'00:00:00#{zone}" : other)
85
85
  else
86
86
  self <=> DateTime.from(other)
87
87
  end
@@ -120,7 +120,7 @@ module OpenHAB
120
120
  when Numeric then DateTime.from(to_time - other)
121
121
  when String
122
122
  dt = DateTime.parse(other)
123
- TIME_ONLY_REGEX =~ other ? self - dt.to_f : time_diff(dt)
123
+ TIME_ONLY_REGEX.match?(other) ? self - dt.to_f : time_diff(dt)
124
124
  when Duration then DateTime.new(zoned_date_time.minus(other))
125
125
  when Time, DateTime, DateTimeType, DateTimeItem then time_diff(other)
126
126
  end
@@ -298,7 +298,7 @@ module OpenHAB
298
298
  # @return [Java::org::openhab::core::library::types::DateTimeType] Object representing the same time
299
299
  #
300
300
  def self.parse(time_string)
301
- time_string += 'Z' if TIME_ONLY_REGEX =~ time_string
301
+ time_string += 'Z' if TIME_ONLY_REGEX.match?(time_string)
302
302
  DateTime.new(DateTimeType.new(time_string))
303
303
  rescue Java::JavaLang::StringIndexOutOfBoundsException, Java::JavaLang::IllegalArgumentException
304
304
  # Try ruby's Time.parse if OpenHAB's DateTimeType parser fails
@@ -5,5 +5,5 @@
5
5
  #
6
6
  module OpenHAB
7
7
  # @return [String] Version of OpenHAB helper libraries
8
- VERSION = '3.9.2'
8
+ VERSION = '3.9.3'
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openhab-scripting
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.2
4
+ version: 3.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian O'Connell