Just giving you some ideas of how it would look like in JRuby:
Nashorn JS | JRuby |
---|---|
itemRegistry.getItem("someItemName").getState(); |
someItemName.state |
events.sendCommand(someItem, ON); |
someItem.on |
if (someItem.getState() === ON) |
if someItem.on? See item state |
var MemberList = Java.from(itemRegistry.getItem(groupItemName).members); |
member_list = groupItemName.members |
var HomeLocation = new PointType(new DecimalType(21.12345), new DecimalType(10.853317)); |
home_location = PointType.new(21.12345, 10.853317) |
The number of members:
NetworkDevicesOnline.members.size # The number of members
NetworkDevicesOnline.members.select(&:on?).size # The number of members that are in the ON state
See:
- JRuby Discussion
- JRuby’s Main Documentation
- Converting Rules to JRuby
- More examples in JRuby
- Learn Ruby Basics
If you post some of your actual rules, I’ll be happy to convert them for you into jruby to get you started.