You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tutorials/getting_started/rules_advanced.md
+7-5
Original file line number
Diff line number
Diff line change
@@ -211,7 +211,7 @@ actions.ScriptExecution.createTimer(time.ZonedDateTime.now().plusMinutes(30), li
211
211
::: tab JRuby
212
212
213
213
Timers are created by calling the [after](https://openhab.github.io/openhab-jruby/main/OpenHAB/DSL.html#after-class_method) method.
214
-
It accepts a [Duration](https://openhab.github.io/openhab-jruby/main/OpenHAB/CoreExt/Java/Duration.html), a Ruby [Time](https://docs.ruby-lang.org/en/master/Time.htmll), or a java[ZonedDateTime](https://openhab.github.io/openhab-jruby/main/OpenHAB/CoreExt/Java/ZonedDateTime.html) object to specify when the timer should execute.
214
+
It accepts a [Duration](https://openhab.github.io/openhab-jruby/main/OpenHAB/CoreExt/Java/Duration.html), a Ruby [Time](https://docs.ruby-lang.org/en/master/Time.htmll), or a Java[ZonedDateTime](https://openhab.github.io/openhab-jruby/main/OpenHAB/CoreExt/Java/ZonedDateTime.html) object to specify when the timer should execute.
215
215
Most of the time, a Duration is used, and the helper library offers a [convenient syntax](https://openhab.github.io/openhab-jruby/main/index.html#durations), e.g. `30.minutes`, to create a Duration object.
216
216
217
217
```ruby
@@ -273,8 +273,10 @@ It could be coded to reuse the Timer instead which is an exercise for the reader
273
273
274
274
In JRuby, an easy way to reschedule the same timer is done by providing a unique `id` to the timer.
275
275
This is called a [reentrant timer](https://openhab.github.io/openhab-jruby/main/OpenHAB/DSL.html#reentrant-timers).
276
+
When [after](https://openhab.github.io/openhab-jruby/main/OpenHAB/DSL.html#after-class_method) with an `id` is executed the first time, a new timer will be created.
277
+
Subsequent executions will reschedule the same timer instead of creating a new timer.
276
278
277
-
The most convenient ID to use is the Item object for which the timer is operating, but you can use anything as the ID, e.g. a String, a number, the rule uid, etc.
279
+
The most convenient `id` to use is the Item object for which the timer is operating, but you can use anything as the ID, e.g. a String, a number, the rule uid, etc.
278
280
279
281
```ruby
280
282
logger.info "Motion was detected"
@@ -402,8 +404,8 @@ gemfile do
402
404
end
403
405
```
404
406
405
-
[Personal libraries](https://openhab.github.io/openhab-jruby/main/index.html#shared-code) that contain your custom reusable constants, functions, data structures, and classes can be created and used inside your Script Actions and Conditions.
406
-
Simply save a `.rb` file that contain your code in `$OH_CONF/automation/ruby/lib/` folder, then `require` it in your script.
407
+
[Personal libraries](https://openhab.github.io/openhab-jruby/main/index.html#shared-code) that contain your custom reusable constants, methods, modules, and classes can be created and used inside your Script Actions and Conditions.
408
+
Simply save a `.rb` file that contains your code in `$OH_CONF/automation/ruby/lib/` folder, then `require` it in your script.
407
409
408
410
For example, a personal library file in `$OH_CONF/automation/ruby/lib/mylibs.rb`:
0 commit comments