mushy 0.15.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mushy/fluxs/filter.rb +29 -2
- data/mushy.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c7413fc5021f3f75a4bc76d587e8cf608cf16d39c91bab9caf3916d0eebcc97
|
4
|
+
data.tar.gz: c4480bd98782f580b3949e4f956c9aab3cce8387ccf923a284ae4b113e316bab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e9a557ea1b36bd47af03d8b392d2f74e7ad2eefa7c83fa3a81130e8cb5b5bda8be8750bdb649bd8b1ead65cb295ed9d45ce6fe0a89c419d3073e68d9e242b4b
|
7
|
+
data.tar.gz: bb0f6fc0ac8d21049841d27ffa991a39ad3328c16313799926d25a0b6b1646c12705bc5e4206afce2e5c12b4badb42b6ea969fe7ac20842bce1aed5bd88af986
|
data/lib/mushy/fluxs/filter.rb
CHANGED
@@ -21,13 +21,27 @@ module Mushy
|
|
21
21
|
type: 'keyvalue',
|
22
22
|
value: {},
|
23
23
|
},
|
24
|
+
contains: {
|
25
|
+
description: 'Provide key/value pairs that must be contained.',
|
26
|
+
shrink: true,
|
27
|
+
label: 'Contains',
|
28
|
+
type: 'keyvalue',
|
29
|
+
value: {},
|
30
|
+
},
|
31
|
+
notcontains: {
|
32
|
+
description: 'Provide key/value pairs that must NOT be contained.',
|
33
|
+
shrink: true,
|
34
|
+
label: 'Not Contains',
|
35
|
+
type: 'keyvalue',
|
36
|
+
value: {},
|
37
|
+
},
|
24
38
|
},
|
25
39
|
}
|
26
40
|
end
|
27
41
|
|
28
42
|
def process event, config
|
29
43
|
|
30
|
-
differences = [:equal, :notequal]
|
44
|
+
differences = [:equal, :notequal, :contains, :notcontains]
|
31
45
|
.select { |x| config[x].is_a? Hash }
|
32
46
|
.map { |x| config[x].map { |k, v| { m: x, k: k, v1: v } } }
|
33
47
|
.flatten
|
@@ -42,7 +56,7 @@ module Mushy
|
|
42
56
|
def equal a, b
|
43
57
|
[a, b]
|
44
58
|
.map { |x| numeric?(x) ? x.to_f : x }
|
45
|
-
.map { |x| x
|
59
|
+
.map { |x| nice_string x }
|
46
60
|
.group_by { |x| x }
|
47
61
|
.count == 1
|
48
62
|
end
|
@@ -51,10 +65,23 @@ module Mushy
|
|
51
65
|
equal(a, b) == false
|
52
66
|
end
|
53
67
|
|
68
|
+
def contains a, b
|
69
|
+
return false unless b
|
70
|
+
nice_string(b).include? a.downcase
|
71
|
+
end
|
72
|
+
|
73
|
+
def notcontains a, b
|
74
|
+
contains(a, b) == false
|
75
|
+
end
|
76
|
+
|
54
77
|
def numeric? value
|
55
78
|
Float(value) != nil rescue false
|
56
79
|
end
|
57
80
|
|
81
|
+
def nice_string value
|
82
|
+
value.to_s.strip.downcase
|
83
|
+
end
|
84
|
+
|
58
85
|
end
|
59
86
|
|
60
87
|
end
|
data/mushy.gemspec
CHANGED
@@ -4,7 +4,7 @@ require 'mushy/version'
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = 'mushy'
|
7
|
-
s.version = '0.15.
|
7
|
+
s.version = '0.15.1'
|
8
8
|
s.date = '2020-11-23'
|
9
9
|
s.summary = 'Process streams of work using common modules.'
|
10
10
|
s.description = 'This tool assists in the creation and processing of workflows.'
|