Created
December 5, 2011 13:04
-
-
Save simen/1433530 to your computer and use it in GitHub Desktop.
Match with constraint counting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"identity:7" => [1,2,4] | |
"realm:mittap" => [1,3,4] | |
"body:'Hello…' => [4] | |
1: rule: {identity: 7, realm: 'mittap'}, number_of_constraints: 2 | |
2: rule: {identity: 7}, number_of_constraints: 1 | |
3: rule: {identity: 8, realm: 'mittap'}, number_of_constraints: 2 | |
4: rule: {identity: 7, realm: 'mittap', body: "Hello from number 7"}, number_of_constraints: 3 | |
message = {identity: 7, body: "Hello from number 7"} | |
single_constraint_match = find_applicable_rules(message) => [1,2,4,1,3,4,4] | |
count_matches(single_constraint_match) | |
=> 1 => 2 | |
2 => 1 | |
3 => 1 | |
4 => 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment