durable_rules 0.34.49 → 0.34.51
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/librb/engine.rb +16 -0
- data/src/rules/events.c +3 -3
- data/src/rulesrb/rules.c +6 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9db587bb8df6b72055812d37c3b3db5e1bebba8f
|
4
|
+
data.tar.gz: 3f35d2c234db4ae3c5d50619a52e743b0146f051
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55c856dd6335c44e34fb5b85d88d74c1443e3fde82ee1b3c798feb1bd5b52c06bda645c1922bbcb69ee0a6ff2ec98592bcb68e864b1a57e77a9ec043f356c46e
|
7
|
+
data.tar.gz: b74146ddba7bd15e620b652ca0a0138244dfc4bce8dc95356fc082e37b1ee89c1dac7e0fe469aee5a75045414e8a6861cc725117b34678667db7a7a2b091bfe9
|
data/librb/engine.rb
CHANGED
@@ -1160,18 +1160,34 @@ module Engine
|
|
1160
1160
|
end
|
1161
1161
|
|
1162
1162
|
def post(ruleset_name, event)
|
1163
|
+
if event.kind_of? Array
|
1164
|
+
return post_batch ruleset_name, event
|
1165
|
+
end
|
1166
|
+
|
1163
1167
|
get_ruleset(ruleset_name).assert_event event
|
1164
1168
|
end
|
1165
1169
|
|
1166
1170
|
def start_post(ruleset_name, event)
|
1171
|
+
if event.kind_of? Array
|
1172
|
+
return start_post_batch ruleset_name, event
|
1173
|
+
end
|
1174
|
+
|
1167
1175
|
get_ruleset(ruleset_name).start_assert_event event
|
1168
1176
|
end
|
1169
1177
|
|
1170
1178
|
def assert(ruleset_name, fact)
|
1179
|
+
if fact.kind_of? Array
|
1180
|
+
return assert_facts ruleset_name, fact
|
1181
|
+
end
|
1182
|
+
|
1171
1183
|
get_ruleset(ruleset_name).assert_fact fact
|
1172
1184
|
end
|
1173
1185
|
|
1174
1186
|
def start_assert(ruleset_name, fact)
|
1187
|
+
if fact.kind_of? Array
|
1188
|
+
return start_assert_facts ruleset_name, fact
|
1189
|
+
end
|
1190
|
+
|
1175
1191
|
get_ruleset(ruleset_name).start_assert_fact fact
|
1176
1192
|
end
|
1177
1193
|
|
data/src/rules/events.c
CHANGED
@@ -938,7 +938,6 @@ static unsigned int isArrayMatch(ruleset *tree,
|
|
938
938
|
alpha *arrayAlpha,
|
939
939
|
unsigned char *propertyMatch,
|
940
940
|
void **rulesBinding) {
|
941
|
-
*propertyMatch = 0;
|
942
941
|
unsigned int result = RULES_OK;
|
943
942
|
if (currentProperty->type != JSON_ARRAY) {
|
944
943
|
return RULES_OK;
|
@@ -950,6 +949,7 @@ static unsigned int isArrayMatch(ruleset *tree,
|
|
950
949
|
jsonObject jo;
|
951
950
|
result = readNextArrayValue(first, &first, &last, &type);
|
952
951
|
while (result == PARSE_OK) {
|
952
|
+
*propertyMatch = 0;
|
953
953
|
unsigned short top = 1;
|
954
954
|
alpha *stack[MAX_STACK_SIZE];
|
955
955
|
stack[0] = arrayAlpha;
|
@@ -1052,13 +1052,13 @@ static unsigned int isArrayMatch(ruleset *tree,
|
|
1052
1052
|
if ((currentAlpha->betaListOffset || !currentAlpha->nextOffset) && currentAlpha != arrayAlpha) {
|
1053
1053
|
*propertyMatch = 1;
|
1054
1054
|
break;
|
1055
|
-
}
|
1055
|
+
}
|
1056
1056
|
}
|
1057
1057
|
|
1058
1058
|
if ((arrayAlpha->operator == OP_IALL && !*propertyMatch) ||
|
1059
1059
|
(arrayAlpha->operator == OP_IANY && *propertyMatch)) {
|
1060
1060
|
break;
|
1061
|
-
}
|
1061
|
+
}
|
1062
1062
|
|
1063
1063
|
result = readNextArrayValue(last, &first, &last, &type);
|
1064
1064
|
}
|
data/src/rulesrb/rules.c
CHANGED
@@ -196,7 +196,9 @@ static VALUE rbAssertEvents(VALUE self, VALUE handle, VALUE events) {
|
|
196
196
|
Check_Type(events, T_STRING);
|
197
197
|
|
198
198
|
unsigned int result = assertEvents(FIX2INT(handle), RSTRING_PTR(events));
|
199
|
-
if (result
|
199
|
+
if (result == RULES_OK || result == ERR_EVENT_NOT_HANDLED || result == ERR_EVENT_OBSERVED) {
|
200
|
+
return INT2FIX(result);
|
201
|
+
} else {
|
200
202
|
if (result == ERR_OUT_OF_MEMORY) {
|
201
203
|
rb_raise(rb_eNoMemError, "Out of memory");
|
202
204
|
} else {
|
@@ -312,7 +314,9 @@ static VALUE rbAssertFacts(VALUE self, VALUE handle, VALUE facts) {
|
|
312
314
|
Check_Type(facts, T_STRING);
|
313
315
|
|
314
316
|
unsigned int result = assertFacts(FIX2INT(handle), RSTRING_PTR(facts));
|
315
|
-
if (result
|
317
|
+
if (result == RULES_OK || result == ERR_EVENT_NOT_HANDLED || result == ERR_EVENT_OBSERVED) {
|
318
|
+
return INT2FIX(result);
|
319
|
+
} else {
|
316
320
|
if (result == ERR_OUT_OF_MEMORY) {
|
317
321
|
rb_raise(rb_eNoMemError, "Out of memory");
|
318
322
|
} else {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: durable_rules
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.34.
|
4
|
+
version: 0.34.51
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesus Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|