openhab-scripting 2.16.1 → 2.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/lib/openhab.rb +12 -16
  3. data/lib/openhab/core/entity_lookup.rb +168 -0
  4. data/lib/openhab/core/openhab_setup.rb +31 -0
  5. data/lib/openhab/core/osgi.rb +61 -0
  6. data/lib/openhab/dsl/actions.rb +105 -0
  7. data/lib/openhab/dsl/dsl.rb +49 -0
  8. data/lib/openhab/{core/dsl → dsl}/gems.rb +0 -1
  9. data/lib/openhab/dsl/group.rb +100 -0
  10. data/lib/openhab/dsl/items/datetime_item.rb +97 -0
  11. data/lib/openhab/dsl/items/items.rb +46 -0
  12. data/lib/openhab/dsl/items/number_item.rb +352 -0
  13. data/lib/openhab/dsl/items/string_item.rb +120 -0
  14. data/lib/openhab/dsl/monkey_patch/actions/actions.rb +4 -0
  15. data/lib/openhab/dsl/monkey_patch/actions/script_thing_actions.rb +32 -0
  16. data/lib/openhab/dsl/monkey_patch/events/events.rb +5 -0
  17. data/lib/openhab/dsl/monkey_patch/events/item_command.rb +23 -0
  18. data/lib/openhab/dsl/monkey_patch/events/item_state_changed.rb +35 -0
  19. data/lib/openhab/dsl/monkey_patch/events/thing_status_info.rb +33 -0
  20. data/lib/openhab/dsl/monkey_patch/items/contact_item.rb +61 -0
  21. data/lib/openhab/dsl/monkey_patch/items/dimmer_item.rb +193 -0
  22. data/lib/openhab/dsl/monkey_patch/items/group_item.rb +37 -0
  23. data/lib/openhab/dsl/monkey_patch/items/items.rb +133 -0
  24. data/lib/openhab/dsl/monkey_patch/items/metadata.rb +281 -0
  25. data/lib/openhab/dsl/monkey_patch/items/persistence.rb +70 -0
  26. data/lib/openhab/dsl/monkey_patch/items/switch_item.rb +95 -0
  27. data/lib/openhab/dsl/monkey_patch/ruby/number.rb +39 -0
  28. data/lib/openhab/dsl/monkey_patch/ruby/range.rb +47 -0
  29. data/lib/openhab/dsl/monkey_patch/ruby/ruby.rb +8 -0
  30. data/lib/openhab/dsl/monkey_patch/ruby/string.rb +41 -0
  31. data/lib/openhab/dsl/monkey_patch/ruby/time.rb +32 -0
  32. data/lib/openhab/dsl/monkey_patch/types/decimal_type.rb +70 -0
  33. data/lib/openhab/dsl/monkey_patch/types/on_off_type.rb +51 -0
  34. data/lib/openhab/dsl/monkey_patch/types/open_closed_type.rb +36 -0
  35. data/lib/openhab/dsl/monkey_patch/types/percent_type.rb +32 -0
  36. data/lib/openhab/dsl/monkey_patch/types/quantity_type.rb +69 -0
  37. data/lib/openhab/dsl/monkey_patch/types/types.rb +8 -0
  38. data/lib/openhab/dsl/persistence.rb +25 -0
  39. data/lib/openhab/dsl/rules/automation_rule.rb +342 -0
  40. data/lib/openhab/dsl/rules/guard.rb +134 -0
  41. data/lib/openhab/dsl/rules/property.rb +102 -0
  42. data/lib/openhab/dsl/rules/rule.rb +116 -0
  43. data/lib/openhab/dsl/rules/rule_config.rb +151 -0
  44. data/lib/openhab/dsl/rules/triggers/changed.rb +143 -0
  45. data/lib/openhab/dsl/rules/triggers/channel.rb +53 -0
  46. data/lib/openhab/dsl/rules/triggers/command.rb +104 -0
  47. data/lib/openhab/dsl/rules/triggers/cron.rb +177 -0
  48. data/lib/openhab/dsl/rules/triggers/trigger.rb +124 -0
  49. data/lib/openhab/dsl/rules/triggers/updated.rb +98 -0
  50. data/lib/openhab/dsl/states.rb +61 -0
  51. data/lib/openhab/dsl/things.rb +91 -0
  52. data/lib/openhab/dsl/time_of_day.rb +232 -0
  53. data/lib/openhab/dsl/timers.rb +77 -0
  54. data/lib/openhab/dsl/types/datetime.rb +326 -0
  55. data/lib/openhab/dsl/types/quantity.rb +290 -0
  56. data/lib/openhab/dsl/units.rb +39 -0
  57. data/lib/openhab/log/configuration.rb +21 -0
  58. data/lib/openhab/log/logger.rb +172 -0
  59. data/lib/openhab/version.rb +1 -1
  60. metadata +58 -58
  61. data/lib/openhab/configuration.rb +0 -16
  62. data/lib/openhab/core/cron.rb +0 -27
  63. data/lib/openhab/core/debug.rb +0 -34
  64. data/lib/openhab/core/dsl.rb +0 -51
  65. data/lib/openhab/core/dsl/actions.rb +0 -107
  66. data/lib/openhab/core/dsl/entities.rb +0 -140
  67. data/lib/openhab/core/dsl/group.rb +0 -93
  68. data/lib/openhab/core/dsl/items/items.rb +0 -51
  69. data/lib/openhab/core/dsl/items/number_item.rb +0 -323
  70. data/lib/openhab/core/dsl/items/string_item.rb +0 -122
  71. data/lib/openhab/core/dsl/monkey_patch/actions/actions.rb +0 -4
  72. data/lib/openhab/core/dsl/monkey_patch/actions/script_thing_actions.rb +0 -22
  73. data/lib/openhab/core/dsl/monkey_patch/events.rb +0 -5
  74. data/lib/openhab/core/dsl/monkey_patch/events/item_command.rb +0 -13
  75. data/lib/openhab/core/dsl/monkey_patch/events/item_state_changed.rb +0 -25
  76. data/lib/openhab/core/dsl/monkey_patch/events/thing_status_info.rb +0 -26
  77. data/lib/openhab/core/dsl/monkey_patch/items/contact_item.rb +0 -54
  78. data/lib/openhab/core/dsl/monkey_patch/items/dimmer_item.rb +0 -182
  79. data/lib/openhab/core/dsl/monkey_patch/items/group_item.rb +0 -27
  80. data/lib/openhab/core/dsl/monkey_patch/items/items.rb +0 -132
  81. data/lib/openhab/core/dsl/monkey_patch/items/metadata.rb +0 -283
  82. data/lib/openhab/core/dsl/monkey_patch/items/persistence.rb +0 -72
  83. data/lib/openhab/core/dsl/monkey_patch/items/switch_item.rb +0 -87
  84. data/lib/openhab/core/dsl/monkey_patch/ruby/number.rb +0 -41
  85. data/lib/openhab/core/dsl/monkey_patch/ruby/range.rb +0 -47
  86. data/lib/openhab/core/dsl/monkey_patch/ruby/ruby.rb +0 -7
  87. data/lib/openhab/core/dsl/monkey_patch/ruby/string.rb +0 -43
  88. data/lib/openhab/core/dsl/monkey_patch/types/decimal_type.rb +0 -60
  89. data/lib/openhab/core/dsl/monkey_patch/types/on_off_type.rb +0 -41
  90. data/lib/openhab/core/dsl/monkey_patch/types/open_closed_type.rb +0 -25
  91. data/lib/openhab/core/dsl/monkey_patch/types/percent_type.rb +0 -23
  92. data/lib/openhab/core/dsl/monkey_patch/types/quantity_type.rb +0 -58
  93. data/lib/openhab/core/dsl/monkey_patch/types/types.rb +0 -8
  94. data/lib/openhab/core/dsl/persistence.rb +0 -27
  95. data/lib/openhab/core/dsl/property.rb +0 -96
  96. data/lib/openhab/core/dsl/rule/automation_rule.rb +0 -348
  97. data/lib/openhab/core/dsl/rule/guard.rb +0 -136
  98. data/lib/openhab/core/dsl/rule/rule.rb +0 -117
  99. data/lib/openhab/core/dsl/rule/rule_config.rb +0 -153
  100. data/lib/openhab/core/dsl/rule/triggers/changed.rb +0 -145
  101. data/lib/openhab/core/dsl/rule/triggers/channel.rb +0 -55
  102. data/lib/openhab/core/dsl/rule/triggers/command.rb +0 -106
  103. data/lib/openhab/core/dsl/rule/triggers/cron.rb +0 -160
  104. data/lib/openhab/core/dsl/rule/triggers/trigger.rb +0 -126
  105. data/lib/openhab/core/dsl/rule/triggers/updated.rb +0 -100
  106. data/lib/openhab/core/dsl/states.rb +0 -63
  107. data/lib/openhab/core/dsl/things.rb +0 -93
  108. data/lib/openhab/core/dsl/time_of_day.rb +0 -231
  109. data/lib/openhab/core/dsl/timers.rb +0 -79
  110. data/lib/openhab/core/dsl/types/quantity.rb +0 -292
  111. data/lib/openhab/core/dsl/units.rb +0 -41
  112. data/lib/openhab/core/log.rb +0 -170
  113. data/lib/openhab/core/patch_load_path.rb +0 -7
  114. data/lib/openhab/core/startup_delay.rb +0 -23
  115. data/lib/openhab/osgi.rb +0 -59
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #
4
- # Monkey patch Group Item
5
- #
6
- # rubocop:disable Style/ClassAndModuleChildren
7
- class Java::OrgOpenhabCoreItems::GroupItem
8
- # rubocop:enable Style/ClassAndModuleChildren
9
-
10
- #
11
- # Get all items in a group
12
- #
13
- # @return [Array] Array of items in the group
14
- #
15
- def items
16
- to_a
17
- end
18
-
19
- #
20
- # Get all items in the group as an Array
21
- #
22
- # @return [Array] All items in the group
23
- #
24
- def to_a
25
- all_members.each_with_object([]) { |item, arr| arr << item }
26
- end
27
- end
@@ -1,132 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'java'
4
- require 'openhab/core/log'
5
- require 'bigdecimal'
6
-
7
- # Monkey patch items
8
- require 'openhab/core/dsl/monkey_patch/items/metadata'
9
- require 'openhab/core/dsl/monkey_patch/items/persistence'
10
- require 'openhab/core/dsl/monkey_patch/items/contact_item'
11
- require 'openhab/core/dsl/monkey_patch/items/dimmer_item'
12
- require 'openhab/core/dsl/monkey_patch/items/switch_item'
13
- require 'openhab/core/dsl/monkey_patch/items/group_item'
14
-
15
- module OpenHAB
16
- module Core
17
- module DSL
18
- module MonkeyPatch
19
- #
20
- # Monkeypatches Items
21
- #
22
- module Items
23
- #
24
- # Extensions for Items
25
- #
26
- module ItemExtensions
27
- include Logging
28
- java_import org.openhab.core.model.script.actions.BusEvent
29
- java_import org.openhab.core.types.UnDefType
30
-
31
- #
32
- # Send a command to this item
33
- #
34
- # @param [Object] command to send to object
35
- #
36
- #
37
- def command(command)
38
- command = command.to_java.strip_trailing_zeros if command.is_a? BigDecimal
39
- logger.trace "Sending Command #{command} to #{id}"
40
- BusEvent.sendCommand(self, command.to_s)
41
- end
42
-
43
- alias << command
44
-
45
- #
46
- # Send an update to this item
47
- #
48
- # @param [Object] update the item
49
- #
50
- #
51
- def update(update)
52
- logger.trace "Sending Update #{update} to #{id}"
53
- BusEvent.postUpdate(self, update.to_s)
54
- end
55
-
56
- #
57
- # Check if the item state == UNDEF
58
- #
59
- # @return [Boolean] True if the state is UNDEF, false otherwise
60
- #
61
- def undef?
62
- # Need to explicitly call the super method version because this state will never return UNDEF
63
- method(:state).super_method.call == UnDefType::UNDEF
64
- end
65
-
66
- #
67
- # Check if the item state == NULL
68
- #
69
- # @return [Boolean] True if the state is NULL, false otherwise
70
- def null?
71
- # Need to explicitly call the super method version because this state will never return NULL
72
- method(:state).super_method.call == UnDefType::NULL
73
- end
74
-
75
- #
76
- # Check if the item has a state (not UNDEF or NULL)
77
- #
78
- # @return [Boolean] True if state is not UNDEF or NULL
79
- #
80
- def state?
81
- undef? == false && null? == false
82
- end
83
-
84
- #
85
- # Get the item state
86
- #
87
- # @return [State] OpenHAB item state if state is not UNDEF or NULL, nil otherwise
88
- #
89
- def state
90
- super if state?
91
- end
92
-
93
- #
94
- # Get an ID for the item, using the item label if set, otherwise item name
95
- #
96
- # @return [String] label if set otherwise name
97
- #
98
- def id
99
- label || name
100
- end
101
-
102
- #
103
- # Get the string representation of the state of the item
104
- #
105
- # @return [String] State of the item as a string if not UNDEF or NULL, nil otherwise
106
- #
107
- def to_s
108
- state&.to_s
109
- end
110
-
111
- #
112
- # Inspect the item
113
- #
114
- # @return [String] details of the item
115
- #
116
- def inspect
117
- toString
118
- end
119
- end
120
- end
121
- end
122
- end
123
- end
124
- end
125
-
126
- # rubocop:disable Style/ClassAndModuleChildren
127
- class Java::OrgOpenhabCoreItems::GenericItem
128
- # rubocop:enable Style/ClassAndModuleChildren
129
- prepend OpenHAB::Core::DSL::MonkeyPatch::Items::ItemExtensions
130
- prepend OpenHAB::Core::DSL::MonkeyPatch::Items::Metadata
131
- prepend OpenHAB::Core::DSL::MonkeyPatch::Items::Persistence
132
- end
@@ -1,283 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'java'
4
- require 'delegate'
5
- require 'pp'
6
- require 'forwardable'
7
- require 'openhab/osgi'
8
- require 'openhab/core/log'
9
-
10
- module OpenHAB
11
- module Core
12
- module DSL
13
- module MonkeyPatch
14
- module Items
15
- #
16
- # Metadata extension for Items
17
- #
18
- module Metadata
19
- include Logging
20
-
21
- java_import org.openhab.core.items.Metadata
22
- java_import org.openhab.core.items.MetadataKey
23
-
24
- #
25
- # Provide the interface to access namespace's value and configuration
26
- #
27
- class MetadataItem < SimpleDelegator
28
- extend Forwardable
29
-
30
- def_delegator :@metadata, :value
31
-
32
- def initialize(metadata: nil, key: nil, value: nil, config: nil)
33
- @metadata = metadata || Metadata.new(key || MetadataKey.new('', ''), value, config)
34
- super(@metadata&.configuration)
35
- end
36
-
37
- #
38
- # Updates the metadata configuration associated with the key
39
- #
40
- def []=(key, value)
41
- configuration = {}.merge(@metadata&.configuration || {}).merge({ key => value })
42
- metadata = Metadata.new(@metadata&.uID, @metadata&.value, configuration)
43
- NamespaceAccessor.registry.update(metadata) if @metadata&.uID
44
- end
45
-
46
- #
47
- # Delete the configuration with the given key
48
- #
49
- # @return [Java::Org::openhab::core::items::Metadata] the old metadata
50
- #
51
- def delete(key)
52
- configuration = {}.merge(@metadata&.configuration || {})
53
- configuration.delete(key)
54
- metadata = Metadata.new(@metadata&.uID, @metadata&.value, configuration)
55
- NamespaceAccessor.registry.update(metadata) if @metadata&.uID
56
- end
57
-
58
- #
59
- # Set the metadata value
60
- #
61
- # @return [Java::Org::openhab::core::items::Metadata] the old metadata
62
- #
63
- def value=(value)
64
- raise ArgumentError, 'Value must be a string' unless value.is_a? String
65
-
66
- metadata = Metadata.new(@metadata&.uID, value, @metadata&.configuration)
67
- NamespaceAccessor.registry.update(metadata) if @metadata&.uID
68
- end
69
-
70
- #
71
- # Set the entire configuration to a hash
72
- #
73
- # @return [Java::Org::openhab::core::items::Metadata] the old metadata
74
- #
75
- def config=(config)
76
- raise ArgumentError, 'Configuration must be a hash' unless config.is_a? Hash
77
-
78
- metadata = Metadata.new(@metadata&.uID, @metadata&.value, config)
79
- NamespaceAccessor.registry.update(metadata) if @metadata&.uID
80
- end
81
- alias configuration= config=
82
-
83
- #
84
- # Convert the metadata to an array
85
- #
86
- # @return [Array[2]] An array of [value, configuration]
87
- #
88
- def to_a
89
- [@metadata&.value, @metadata&.configuration || {}]
90
- end
91
- end
92
-
93
- #
94
- # Provide the interface to access item metadata
95
- #
96
- class NamespaceAccessor
97
- include Enumerable
98
-
99
- def initialize(item_name:)
100
- @item_name = item_name
101
- end
102
-
103
- #
104
- # Return the metadata namespace
105
- #
106
- # @return [OpenHAB::Core::DSL::MonkeyPatch::Items::MetadataItem], or nil if the namespace doesn't exist
107
- #
108
- def [](namespace)
109
- logger.trace("Namespaces (#{NamespaceAccessor.registry.getAll})")
110
- logger.trace("Namespace (#{NamespaceAccessor.registry.get(MetadataKey.new(namespace, @item_name))})")
111
- metadata = NamespaceAccessor.registry.get(MetadataKey.new(namespace, @item_name))
112
- MetadataItem.new(metadata: metadata) if metadata
113
- end
114
-
115
- #
116
- # Set the metadata namespace. If the namespace does not exist, it will be created
117
- #
118
- # @param value [Object] The assigned value can be a OpenHAB::Core::DSL::MonkeyPatch::Items::MetadataItem,
119
- # Java::Org::openhab::core::items::Metadata, Array[2] of [value, configuration],
120
- # A String to set the value and clear the configuration,
121
- # or a Hash to set the configuration and set the value to nil
122
- #
123
- # @return [OpenHAB::Core::DSL::MonkeyPatch::Items::MetadataItem]
124
- #
125
- def []=(namespace, value)
126
- meta_value, configuration = update_from_value(value)
127
-
128
- key = MetadataKey.new(namespace, @item_name)
129
- metadata = Metadata.new(key, meta_value, configuration)
130
- # registry.get can be omitted, but registry.update will log a warning for nonexistent metadata
131
- if NamespaceAccessor.registry.get(key)
132
- NamespaceAccessor.registry.update(metadata)
133
- else
134
- NamespaceAccessor.registry.add(metadata)
135
- end
136
- end
137
-
138
- #
139
- # Enumerates through all the namespaces
140
- #
141
- def each
142
- return unless block_given?
143
-
144
- NamespaceAccessor.registry.getAll.each do |meta|
145
- yield meta.uID.namespace, meta.value, meta.configuration if meta.uID.itemName == @item_name
146
- end
147
- end
148
-
149
- #
150
- # Remove all the namespaces
151
- #
152
- def clear
153
- NamespaceAccessor.registry.removeItemMetadata @item_name
154
- end
155
-
156
- #
157
- # Delete a specific namespace
158
- #
159
- # @param namespace [String] The namespace to delete
160
- #
161
- def delete(namespace)
162
- NamespaceAccessor.registry.remove(MetadataKey.new(namespace, @item_name))
163
- end
164
-
165
- alias delete_all clear
166
-
167
- #
168
- # @return [Boolean] True if the given namespace exists, false otherwise
169
- #
170
- def key?(namespace)
171
- !NamespaceAccessor.registry.get(MetadataKey.new(namespace, @item_name)).nil?
172
- end
173
-
174
- alias has_key? key?
175
- alias include? key?
176
-
177
- #
178
- # Merge the given hash with the current metadata. Existing namespace that matches the name
179
- # of the new namespace will be overwritten. Others will be added.
180
- #
181
- def merge!(*others)
182
- return self if others.empty?
183
-
184
- others.each do |other|
185
- case other
186
- when Hash then merge_hash!(other)
187
- when self.class then merge_metadata!(other)
188
- else raise ArgumentError, "merge only supports Hash, or another item's metadata"
189
- end
190
- end
191
- self
192
- end
193
-
194
- #
195
- # @return [String] the string representation of all the namespaces with their value and config
196
- #
197
- def to_s
198
- namespaces = []
199
- each { |ns, value, config| namespaces << "\"#{ns}\"=>[\"#{value}\",#{config}]" }
200
- "{#{namespaces.join(',')}}"
201
- end
202
-
203
- #
204
- # @return [Java::org::openhab::core::items::MetadataRegistry]
205
- #
206
- def self.registry
207
- @registry ||= OpenHAB::OSGI.service('org.openhab.core.items.MetadataRegistry')
208
- end
209
-
210
- private
211
-
212
- #
213
- # perform an updated based on the supplied value
214
- #
215
- # @param [MetadataItem,Metadata,Array,Hash] value to perform update from
216
- #
217
- # @return [Array<Object,Hash>] Array containing the value and configuration based on the
218
- # the supplied object
219
- #
220
- def update_from_value(value)
221
- case value
222
- when MetadataItem then [value.value, value.__getobj__]
223
- when Metadata then [value.value, value.configuration]
224
- when Array
225
- raise ArgumentError, 'Array must contain 2 elements: value, config' if value.length != 2
226
-
227
- value
228
- when Hash then [nil, value]
229
- else [value, nil]
230
- end
231
- end
232
-
233
- #
234
- # Merge the metadata from the supplied other metadata object
235
- #
236
- # @param [Hash] other metadata object to merge
237
- # @yield [key, current_metadata, new_meta] to process merge
238
- #
239
- #
240
- def merge_metadata!(other)
241
- other.each do |key, new_value, new_config|
242
- new_meta = new_value, new_config
243
- if block_given?
244
- current_meta = self[key]&.to_a
245
- new_meta = yield key, current_meta, new_meta unless current_meta.nil?
246
- end
247
- self[key] = new_meta
248
- end
249
- end
250
-
251
- #
252
- # Merge a hash into the metadata
253
- #
254
- # @param [Hash] other to merge into metadata
255
- # @yield [key, current_metadata, new_meta] to process merge
256
- #
257
- #
258
- def merge_hash!(other)
259
- other.each do |key, new_meta|
260
- if block_given?
261
- current_meta = self[key]&.to_a
262
- new_meta = yield key, current_meta, new_meta unless current_meta.nil?
263
- end
264
- self[key] = new_meta
265
- end
266
- end
267
- end
268
-
269
- #
270
- # Accessor to the item's metadata
271
- #
272
- # @return [NamespaceAccessor] an Enumerable object to access item's namespaces
273
- #
274
- def meta
275
- @meta ||= NamespaceAccessor.new(item_name: name)
276
- end
277
- alias metadata meta
278
- end
279
- end
280
- end
281
- end
282
- end
283
- end
@@ -1,72 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module OpenHAB
4
- module Core
5
- module DSL
6
- module MonkeyPatch
7
- module Items
8
- #
9
- # Persistence extension for Items
10
- #
11
- module Persistence
12
- %w[persist last_update].each do |method|
13
- define_method(method) do |service = nil|
14
- service ||= persistence_service
15
- PersistenceExtensions.public_send(method, self, service&.to_s)
16
- end
17
- end
18
-
19
- #
20
- # Return the previous state of the item
21
- #
22
- # @param skip_equal [Boolean] if true, skips equal state values and
23
- # searches the first state not equal the current state
24
- # @param service [String] the name of the PersistenceService to use
25
- #
26
- # @return the previous state or nil if no previous state could be found,
27
- # or if the default persistence service is not configured or
28
- # does not refer to a valid service
29
- #
30
- def previous_state(service = nil, skip_equal: false)
31
- service ||= persistence_service
32
- PersistenceExtensions.previous_state(self, skip_equal, service&.to_s)
33
- end
34
-
35
- %w[
36
- average_since
37
- changed_since
38
- delta_since
39
- deviation_since
40
- evolution_rate
41
- historic_state
42
- maximum_since
43
- minimum_since
44
- sum_since
45
- updated_since
46
- variance_since
47
- ].each do |method|
48
- define_method(method) do |timestamp, service = nil|
49
- service ||= persistence_service
50
- if timestamp.is_a? Java::JavaTimeTemporal::TemporalAmount
51
- timestamp = Java::JavaTime::ZonedDateTime.now.minus(timestamp)
52
- end
53
- PersistenceExtensions.public_send(method, self, timestamp, service&.to_s)
54
- end
55
- end
56
-
57
- private
58
-
59
- #
60
- # Get the specified persistence service from the current thread local variable
61
- #
62
- # @return [Object] Persistence service name as String or Symbol, or nil if not set
63
- #
64
- def persistence_service
65
- Thread.current.thread_variable_get(:persistence_service)
66
- end
67
- end
68
- end
69
- end
70
- end
71
- end
72
- end