<commit_before>Reference Manual
=====
### Table of contents
------
* [Rules](reference.md#rules)
  * [Expressions](reference.md#expressions)
* [Data Model](reference.md#data-model)
* [Flow Structures](reference.md#flow-structures)
  * [Statechart](reference.md#statechart)
  * [Flowchart](reference.md#flowchart)
  * [Parallel](reference.md#parallel)
* [Extensions](reference.md#extensions)

### Rules
------
Rules are the basic building block and consist of antecedent (expression) and consequent (action)

#####Ruby
```ruby
Durable.ruleset :a0 do
  when_all (m.amount < 100) | (m.subject == "approve") | (m.subject == "ok") do
    puts "a0 approved"
  end
end
```
#####Python
```python
with ruleset('a0'):
    @when_all((m.subject == 'go') | (m.subject == 'approve') | (m.subject == 'ok'))
    def approved(c):
        print ('a0 approved ->{0}'.format(c.m.subject))
```
#####JavaScript
```javascript
with (d.ruleset('a0')) {
    whenAll(or(m.amount.lt(100), m.subject.eq('approve'), m.subject.eq('ok')), function (c) {
        console.log('a0 approved from ' + c.s.sid);
    });
}
```  
#####Ruby
```ruby
Durable.ruleset :fraud_detection do
  when_all c.first = m.t == "purchase",
           c.second = m.amount > first.amount * 2,
           c.third = m.amount > second.amount + first.amount,<commit_msg>Update reference.md<commit_after>Reference Manual
=====
### Table of contents
------
* [Rules](reference.md#rules)
  * [Simple Filter](reference.md#simple-filter)
  * [Correlated Sequence](reference.md#correlated-sequence)
* [Data Model](reference.md#data-model)
* [Flow Structures](reference.md#flow-structures)
  * [Statechart](reference.md#statechart)
  * [Flowchart](reference.md#flowchart)
  * [Parallel](reference.md#parallel)
* [Extensions](reference.md#extensions)

### Rules
------
Rules are the basic building block and consist of antecedent (expression) and consequent (action)

#### Simple Filter

#####Ruby
```ruby
Durable.ruleset :a0 do
  when_all (m.amount < 100) | (m.subject == "approve") | (m.subject == "ok") do
    puts "a0 approved"
  end
end
```
#####Python
```python
with ruleset('a0'):
    @when_all((m.subject == 'go') | (m.subject == 'approve') | (m.subject == 'ok'))
    def approved(c):
        print ('a0 approved ->{0}'.format(c.m.subject))
```
#####JavaScript
```javascript
with (d.ruleset('a0')) {
    whenAll(or(m.amount.lt(100), m.subject.eq('approve'), m.subject.eq('ok')), function (c) {
        console.log('a0 approved from ' + c.s.sid);
    });
}
```  
#### Correlated Sequence
#####Ruby
```ruby
Durable.ruleset :fraud_detection do
  when_all c.first = m.t == "purchase",
           c.second = m.amount > first.amount * 2,
           c.third = m.amount > second.amount + first.amount,
{'fraction_non_alphanumeric': 0.20505309410472355, 'fraction_numerical': 0.010252654705236177, 'mean_word_length': 4.031307550644567, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3466094', 'n_tokens_mistral': 980, 'n_tokens_neox': 917, 'n_words': 195}