openhab-scripting 3.9.0 → 3.9.4

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: 48f1fed81c95b87d55603069daa551fa6bdf4783124dd314710ce92153f6ef6f
4
- data.tar.gz: dc9afee52b5ae6f0ac12b0db6c65c36e7ea26b641cd85db06237eed5d2d77dd0
3
+ metadata.gz: 356cf9cd952afd9acdbdb1ee202360b5403b45f252763a5bf9cdfbb3b48f80d6
4
+ data.tar.gz: 813a84b33014c8c6248b7084140c412582d3889226caf08de9e1160452cd50ff
5
5
  SHA512:
6
- metadata.gz: e86c4e605c3f34ed7f56110b3d87e7563d3b307661f6badab6c2f45eef3b9ec68533bc8fa9d5efe604a7ba6e4f1a65b4195cc1c71b2c0f19789b9789d9549e03
7
- data.tar.gz: eb03372db897ac918d4d1f85ab11c84342c15785a3dae4e9bfdfc62c6774f85fe824f0b28f6bae3b4e98223bd38efdc1ac436d00801f87de1884c9591e3569ed
6
+ metadata.gz: 739813b353f513abdb50afff61047f75a7ae96e26b42bf6381e039ef3c35ca7535f696475ccbd999bb79925bee83ecb412533306ce4f7af8566c2a22db4fab8f
7
+ data.tar.gz: 443ad43667b89e0231247879e5dc9eddcf479b9ef2f05f09c08a931e1b13e2a96b1075c2870c95cb608c021e84b17e72850d9b5fb6e7c174f5bfee0d82e86522
@@ -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.0'
8
+ VERSION = '3.9.4'
9
9
  end
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: 3.9.0
4
+ version: 3.9.4
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: 2021-09-17 00:00:00.000000000 Z
11
+ date: 2021-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler