«
Rule languages supports Contacts
| type | name | label | group |
|---|---|---|---|
| Contact | ContactOne | Contact One | Contacts |
# Log contact state
Contacts.select { |c| c == <check> }.each { |contact| logger.info("Contact #{contact.id} is #{contact.state}")}| update | check | log_line | |
|---|---|---|---|
| OPEN | OPEN | Contact One is OPEN | |
| CLOSED | CLOSED | Contact One is CLOSED |
| type | name | label | group |
|---|---|---|---|
| Contact | ContactOne | Contact One | Contacts |
# Log contact state
Contacts.select(&:<check>).each { |contact| logger.info("Contact #{contact.id} is #{contact.state}")}| update | check | log_line | |
|---|---|---|---|
| OPEN | open? | Contact One is OPEN | |
| CLOSED | closed? | Contact One is CLOSED |
| type | name | label | group |
|---|---|---|---|
| Contact | ContactOne | Contact One | Contacts |
| Contact | ContactTwo | Contact Two | Contacts |
# Get all Contacts
items.grep(Contact)
.each { |contact| logger.info("#{contact.id} is a Contact") }| type | name | label | group |
|---|---|---|---|
| Contact | ContactOne | Contact One | Contacts |
# Get dimmers in specific state
Contacts.grep(<update>)
.each { |contact| logger.info("#{contact.id} is in #{contact.state}") }| update | |
|---|---|
| OPEN | |
| CLOSED |
| type | name | label | group |
|---|---|---|---|
| Contact | TestContact | Contact One | Contacts |
#Log if contact is open or closed
case TestContact
when (OPEN)
logger.info("#{TestContact.id} is open")
when (CLOSED)
logger.info("#{TestContact.id} is closed")
end| update | log | |
|---|---|---|
| OPEN | open | |
| CLOSED | closed |
| type | name |
|---|---|
| Contact | TestContact |
logger.info("#{TestContact.id} state is #{TestContact}")