openhab-scripting 3.1.2 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/openhab/dsl/items/datetime_item.rb +1 -0
- data/lib/openhab/dsl/monkey_patch/items/contact_item.rb +2 -0
- data/lib/openhab/dsl/monkey_patch/items/switch_item.rb +2 -0
- data/lib/openhab/dsl/monkey_patch/ruby/string.rb +4 -1
- data/lib/openhab/dsl/monkey_patch/types/on_off_type.rb +15 -0
- data/lib/openhab/dsl/monkey_patch/types/open_closed_type.rb +15 -0
- data/lib/openhab/dsl/monkey_patch/types/up_down_type.rb +15 -0
- data/lib/openhab/dsl/types/datetime.rb +6 -6
- data/lib/openhab/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0be2b09569b3f3e96c5a79dbec4c6b0be6616a46d013831650c1e5d60cee374f
|
4
|
+
data.tar.gz: f71890c321e188f6322191e0c40099a6de22bc086d89085743b0c20f6b211649
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff1e955329247a70b39158dff4a3694f51e2974fb11ce18260ff7048b686ac1181a99c7e941299def6f77697cacdaabf8f67e72d5c8bc0193f3b4334df761f94
|
7
|
+
data.tar.gz: db0fb2c35af26aaa963107b7971e83bfbfdd43c42d951cc470dec1192e8f743978ed91e04859953b5970e076516c275f7133784d12545a842e856181e76ef5af
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'openhab/dsl/types/quantity'
|
4
|
+
require 'openhab/dsl/types/datetime'
|
5
|
+
require 'openhab/dsl/items/datetime_item'
|
4
6
|
|
5
7
|
module OpenHAB
|
6
8
|
module DSL
|
@@ -21,7 +23,8 @@ module OpenHAB
|
|
21
23
|
#
|
22
24
|
def ==(other)
|
23
25
|
case other
|
24
|
-
when OpenHAB::DSL::Types::Quantity, QuantityType, Java::OrgOpenhabCoreLibraryTypes::StringType
|
26
|
+
when OpenHAB::DSL::Types::Quantity, QuantityType, Java::OrgOpenhabCoreLibraryTypes::StringType,
|
27
|
+
OpenHAB::DSL::Types::DateTime, OpenHAB::DSL::Items::DateTimeItem
|
25
28
|
other == self
|
26
29
|
else
|
27
30
|
super
|
@@ -44,6 +44,21 @@ module OpenHAB
|
|
44
44
|
end
|
45
45
|
# rubocop:enable Style/CaseLikeIf
|
46
46
|
end
|
47
|
+
|
48
|
+
#
|
49
|
+
# Test for equality
|
50
|
+
#
|
51
|
+
# @param [Object] other Other object to compare against
|
52
|
+
#
|
53
|
+
# @return [Boolean] true if self and other can be considered equal, false otherwise
|
54
|
+
#
|
55
|
+
def ==(other)
|
56
|
+
if other.respond_to?(:get_state_as)
|
57
|
+
self == other.get_state_as(OnOffType)
|
58
|
+
else
|
59
|
+
super
|
60
|
+
end
|
61
|
+
end
|
47
62
|
end
|
48
63
|
end
|
49
64
|
end
|
@@ -33,6 +33,21 @@ module OpenHAB
|
|
33
33
|
super
|
34
34
|
end
|
35
35
|
end
|
36
|
+
|
37
|
+
#
|
38
|
+
# Test for equality
|
39
|
+
#
|
40
|
+
# @param [Object] other Other object to compare against
|
41
|
+
#
|
42
|
+
# @return [Boolean] true if self and other can be considered equal, false otherwise
|
43
|
+
#
|
44
|
+
def ==(other)
|
45
|
+
if other.respond_to?(:get_state_as)
|
46
|
+
self == other.get_state_as(OpenClosedType)
|
47
|
+
else
|
48
|
+
super
|
49
|
+
end
|
50
|
+
end
|
36
51
|
end
|
37
52
|
end
|
38
53
|
end
|
@@ -30,6 +30,21 @@ module OpenHAB
|
|
30
30
|
super
|
31
31
|
end
|
32
32
|
end
|
33
|
+
|
34
|
+
#
|
35
|
+
# Test for equality
|
36
|
+
#
|
37
|
+
# @param [Object] other Other object to compare against
|
38
|
+
#
|
39
|
+
# @return [Boolean] true if self and other can be considered equal, false otherwise
|
40
|
+
#
|
41
|
+
def ==(other)
|
42
|
+
if other.respond_to?(:get_state_as)
|
43
|
+
self == other.get_state_as(UpDownType)
|
44
|
+
else
|
45
|
+
super
|
46
|
+
end
|
47
|
+
end
|
33
48
|
end
|
34
49
|
end
|
35
50
|
end
|
@@ -75,13 +75,13 @@ module OpenHAB
|
|
75
75
|
# @return [Integer] -1, 0 or 1 depending on the outcome
|
76
76
|
#
|
77
77
|
def <=>(other)
|
78
|
+
if other.respond_to?(:zoned_date_time)
|
79
|
+
return zoned_date_time.to_instant.compare_to(other.zoned_date_time.to_instant)
|
80
|
+
end
|
81
|
+
|
78
82
|
case other
|
79
|
-
when
|
80
|
-
|
81
|
-
when TimeOfDay::TimeOfDay, TimeOfDay::TimeOfDayRangeElement
|
82
|
-
to_tod <=> other
|
83
|
-
when String
|
84
|
-
self <=> DateTime.parse(DATE_ONLY_REGEX =~ other ? "#{other}'T'00:00:00#{zone}" : other)
|
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)
|
85
85
|
else
|
86
86
|
self <=> DateTime.from(other)
|
87
87
|
end
|
data/lib/openhab/version.rb
CHANGED
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.
|
4
|
+
version: 3.2.0
|
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-03-
|
11
|
+
date: 2021-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|