Skip to content

Instantly share code, notes, and snippets.

@dannyrandall
Created January 22, 2021 05:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dannyrandall/8b11d590099ba3762d30c825b2fd1862 to your computer and use it in GitHub Desktop.
Save dannyrandall/8b11d590099ba3762d30c825b2fd1862 to your computer and use it in GitHub Desktop.
ruleset hello_world {
meta {
name "Hello World"
description <<
A first ruleset for the Quickstart
>>
author "Daniel Randall"
shares hello
}
global {
hello = function(obj) {
msg = "Hello " + obj;
msg
}
}
rule hello_world {
select when echo hello
send_directive("say", {"something": "Hello World"})
}
rule hello_monkey {
select when echo monkey
pre {
name = event:attr("name").klog("using name attribute")
|| "Monkey".klog("using default name")
}
send_directive("say", {"something": "Hello " + name})
}
rule hello_monkey_ternary {
select when echo monkeyTernary
pre {
name = event:attr("name")
=> event:attr("name").klog("using name attribute")
| "Monkey".klog("using default name")
}
send_directive("say", {"something": "Hello " + name})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment