openhab-scripting 5.38.0 → 5.38.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dcf7591d994378fb216137014e04dae3321ba891e11f201336e1afc6f1b7226b
4
- data.tar.gz: d9917f8c8f5ead81623e39b3c606ab0f4efe7da519f654b081498bd743ebc721
3
+ metadata.gz: 80e5c451235909f43f9b0b0a82f80a501f0a978d65f52d3bc8dcf8ae5e74fd5e
4
+ data.tar.gz: 57633cd38589cc8e9bd8d11c0bccf66761cdf0aaaffcdde4b6c77ee9388df527
5
5
  SHA512:
6
- metadata.gz: 78aa38c7c90b81ead46d438543077abb55bf06db1476f6e73cf36577f4df10c3b305e5169de2df2580f7d1d963fd8e5a998521764d9377305f87717ff216fff5
7
- data.tar.gz: 9a410509dc518a5019c3885d5123c8a1840a0a70c6abb99df85cdbc11897eb7d5367d6014c71ff16759baebe03083a409f8f254606f0fab22a51ef50f2cdcdc6
6
+ metadata.gz: 67035be352872b9eb97049875648d7e3c5c190e8ea10ee6eb580f039266746f927d24b51844c022c19e75dadd20baaf23450fb35d34d6df43b5046f7cf4fedc9
7
+ data.tar.gz: 74be0ee645c5ba2b480250a5dd3db36773596bb8aec3e0e27b5e96b48da765e4cf5a544d1ae4613ac761c6662e17bde7b1c5bce34038c212080f682dda64508d
@@ -1,5 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- raise "#{__FILE__} is only meant to be required from the context of the Karaf console" unless $terminal
3
+ raise "#{__FILE__} is only meant to be required from the context of the Karaf console" unless $console
4
+
5
+ begin
6
+ $terminal = $console.session.terminal
7
+ rescue NoMethodError
8
+ puts "JRuby console is not available in this environment"
9
+ exit
10
+ end
4
11
 
5
12
  ENV["TERM"] = $terminal.type
@@ -46,13 +46,13 @@ module OpenHAB
46
46
 
47
47
  logger.trace { "Defining #{klass}##{state_predicate} for #{state}" }
48
48
  klass.class_eval <<~RUBY, __FILE__, __LINE__ + 1
49
- def #{state_predicate} # def on?
50
- raw_state.as(#{state.class.java_class.simple_name}).equal?(#{state}) # raw_state.as(OnOffType) == ON
51
- end # end
49
+ def #{state_predicate} # def on?
50
+ raw_state.as(#{state.class.java_class.simple_name}).equal?(#{state}) # raw_state.as(OnOffType) == ON
51
+ end # end
52
52
 
53
- def was_#{state_predicate} # def was_on?
54
- last_state.as(#{state.class.java_class.simple_name}).equal?(#{state}) # last_state.as(OnOffType) == ON
55
- end # end
53
+ def was_#{state_predicate} # def was_on?
54
+ last_state&.as(#{state.class.java_class.simple_name}).equal?(#{state}) # last_state.as(OnOffType) == ON
55
+ end # end
56
56
  RUBY
57
57
  end
58
58
  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.38.0"
7
+ VERSION = "5.38.2"
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.38.0
4
+ version: 5.38.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian O'Connell
@@ -479,7 +479,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
479
479
  - !ruby/object:Gem::Version
480
480
  version: '0'
481
481
  requirements: []
482
- rubygems_version: 3.6.7
482
+ rubygems_version: 3.6.8
483
483
  specification_version: 4
484
484
  summary: JRuby Helper Libraries for openHAB Scripting
485
485
  test_files: []