openhab-scripting 5.18.0 → 5.18.1

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: b1a3e61eb7613c8235e61cf99dc8d97d4c8403d8c2af21f873434ebf89ecff49
4
- data.tar.gz: '09330d12003c08cd0af744d14c52287e9588c9b440975839e3cbd18d4914e027'
3
+ metadata.gz: cfc9ae60d0f82fc677a157ac0efd58c12fc597f5ac8f3d79d7aa9c472e2c5d3a
4
+ data.tar.gz: b8bf1721d064b2f88554722518496aa6c53b89407a9fb212880972725e49901f
5
5
  SHA512:
6
- metadata.gz: 2ee2f0a8eb080aaed28d4484f23828d3e926f957a574e67ab5231ab44cf2dcb46897e841a9a481cdadfa30e1d026b4f4375755ee85f75954707208001d3442d5
7
- data.tar.gz: 95ff1eb5298403900d9fb3370efaf9c3ffa7f356c40d5176a5d9ccf64fce3b6f701b8ddbb2f1103cb3102f3628cf9f27b0e9209cc44e97537eb0e832cc64061d
6
+ metadata.gz: 8e50f4ce2c5832a39b3ab9c7b7a489b22697a23b20ce803a633f28ea9b44ed2661a820cdefd00bc54c71cb212a2c1a1d96c35c413937cd3ac514aec55a4c13da
7
+ data.tar.gz: a298851e7255074cb21d9fd4e495a8c8dc750425b0db3319ab17353c2e07106e0f669a40912bbe98cc6db9f252ff70ebe68b9c94fb7366c4b257200da13eefda
@@ -73,7 +73,7 @@ module OpenHAB
73
73
  # run { logger.info "Happy new day!" }
74
74
  # end
75
75
  #
76
- def rule(name = nil, id: nil, replace: false, script: nil, binding: nil, &block)
76
+ def rule(name = nil, id: nil, replace: nil, script: nil, binding: nil, &block)
77
77
  raise ArgumentError, "Block is required" unless block
78
78
 
79
79
  inferred_id = nil
@@ -89,7 +89,7 @@ module OpenHAB
89
89
 
90
90
  if replace
91
91
  logger.debug { "Removing existing rule '#{builder.uid}'." } if DSL.rules.remove(builder.uid)
92
- else
92
+ elsif replace.nil?
93
93
  id_not_inferred = inferred_id.nil? || inferred_id != builder.uid
94
94
  if id_not_inferred && (existing_rule = $rules.get(builder.uid))
95
95
  logger.warn "Rule '#{builder.uid}' is not created because " \
@@ -44,22 +44,27 @@ module OpenHAB
44
44
  # @see BuilderDSL#$1
45
45
  def def_terse_rule(trigger)
46
46
  class_eval(<<~RUBY, __FILE__, __LINE__ + 1)
47
- def #{trigger}(*args, id: nil, name: nil, description: nil, # def changed(*args, id: nil, name: nil, description: nil,
48
- tag: nil, tags: nil, on_load: false, **kwargs, &block) # tag: nil, tags: nil, on_load: false, **kwargs, &block)
49
- raise ArgumentError, "Block is required" unless block # raise ArgumentError, "Block is required" unless block
50
- #
51
- id ||= NameInference.infer_rule_id_from_block(block) # id ||= NameInference.infer_rule_id_from_block(block)
52
- script = block.source rescue nil # script = block.source rescue nil
53
- caller_binding = block.binding # caller_binding = block.binding
54
- rule name, id: id, script: script, binding: caller_binding do # rule name, id: id, script: script, binding: caller_binding do
55
- self.on_load if on_load # self.on_load if on_load
56
- self.description(description) if description # self.description(description) if description
57
- self.tags(*Array.wrap(tag), *Array.wrap(tags)) # self.tags(*Array.wrap(tag), *Array.wrap(tags))
58
- #{trigger}(*args, **kwargs) # changed(*args, **kwargs)
59
- run(&block) # run(&block)
60
- end # end
61
- end # end
62
- module_function #{trigger.inspect} # module_function :changed
47
+ def #{trigger}(*args, id: nil, name: nil, description: nil, # def changed(*args, id: nil, name: nil, description: nil,
48
+ tag: nil, tags: nil, on_load: false, **kwargs, &block) # tag: nil, tags: nil, on_load: false, **kwargs, &block)
49
+ raise ArgumentError, "Block is required" unless block # raise ArgumentError, "Block is required" unless block
50
+ #
51
+ replace = nil # replace = nil
52
+ unless id # unless id
53
+ replace = false # replace = false
54
+ id = NameInference.infer_rule_id_from_block(block) # id = NameInference.infer_rule_id_from_block(block)
55
+ end # end
56
+ script = block.source rescue nil # script = block.source rescue nil
57
+ caller_binding = block.binding # caller_binding = block.binding
58
+ rule name, id: id, replace: replace, script: script, # rule name, id: id, replace: replace, script: script
59
+ binding: caller_binding do # binding: caller_binding do
60
+ self.on_load if on_load # self.on_load if on_load
61
+ self.description(description) if description # self.description(description) if description
62
+ self.tags(*Array.wrap(tag), *Array.wrap(tags)) # self.tags(*Array.wrap(tag), *Array.wrap(tags))
63
+ #{trigger}(*args, **kwargs) # changed(*args, **kwargs)
64
+ run(&block) # run(&block)
65
+ end # end
66
+ end # end
67
+ module_function #{trigger.inspect} # module_function :changed
63
68
  RUBY
64
69
  end
65
70
  end
@@ -4,6 +4,6 @@ module OpenHAB
4
4
  module DSL
5
5
  # Version of openHAB helper libraries
6
6
  # @return [String]
7
- VERSION = "5.18.0"
7
+ VERSION = "5.18.1"
8
8
  end
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: 5.18.0
4
+ version: 5.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian O'Connell
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-03-05 00:00:00.000000000 Z
13
+ date: 2024-04-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -485,7 +485,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
485
485
  - !ruby/object:Gem::Version
486
486
  version: '0'
487
487
  requirements: []
488
- rubygems_version: 3.5.6
488
+ rubygems_version: 3.5.7
489
489
  signing_key:
490
490
  specification_version: 4
491
491
  summary: JRuby Helper Libraries for openHAB Scripting