dap 0.0.19 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 41ed75c82a789ae7a55632cce6685d6626203fa9
4
- data.tar.gz: 6199c55b1a7b644266bcd86158c77185428b48fc
3
+ metadata.gz: 47ecf168f8bc6242364441c3181c9fce903662d5
4
+ data.tar.gz: 1e566ba434fe69f3a9c6aaa099013f9be8f526fd
5
5
  SHA512:
6
- metadata.gz: 86e601032009d945c9acc73e6593461f1b546afd87c0ddd95120206ee1372973256e4b89cbaf949c3468dae50cf88883206556d1549248cf0643d9a4534c6661
7
- data.tar.gz: 5f5d1e653b51bf84cd30df7db24e81955d6a80226920807bddd7b858abdebdf2b810476055aec6f3724e7aff4484967d98aceda7fe499be119808182c72d627b
6
+ metadata.gz: e893cacfbcc0bc02d6a1e1190c5843a8aeb372ed63a28929952f0afb56d2d600f1a24c8c5fc019f479590107e6618c2898b64603c20a77b617876a6bdfe05607
7
+ data.tar.gz: '0508097ed78aaa9454d459ba8e0365b1a99ab9968c3e2b478150a74b868c74760bdb7c9ca34af406c566e544c50b3e791180643e105b7f37ff9089f83e798e13'
@@ -5,6 +5,19 @@ require 'digest/sha2'
5
5
  module Dap
6
6
  module Filter
7
7
 
8
+ class FilterCopy
9
+ include Base
10
+
11
+ def process(doc)
12
+ self.opts.each_pair do |k,v|
13
+ if doc.has_key?(k)
14
+ doc[v] = doc[k]
15
+ end
16
+ end
17
+ [ doc ]
18
+ end
19
+ end
20
+
8
21
  class FilterRename
9
22
  include Base
10
23
 
@@ -26,6 +39,19 @@ class FilterRename
26
39
  [ doc ]
27
40
  end
28
41
  end
42
+ class FilterMatchRemove
43
+ include Base
44
+ def process(doc)
45
+ self.opts.each_pair do |re,_|
46
+ doc.each_key do |k|
47
+ if k.match(re)
48
+ doc.delete(k)
49
+ end
50
+ end
51
+ end
52
+ [ doc ]
53
+ end
54
+ end
29
55
 
30
56
  class FilterRemove
31
57
  include Base
data/lib/dap/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dap
2
- VERSION = "0.0.19"
2
+ VERSION = "0.0.20"
3
3
  end
@@ -1,3 +1,17 @@
1
+ describe Dap::Filter::FilterCopy do
2
+ describe '.process' do
3
+
4
+ let(:filter) { described_class.new(["foo=bar"]) }
5
+
6
+ context 'copy one json field to another' do
7
+ let(:process) { filter.process({"foo" => "bar"}) }
8
+ it 'copies and leaves the original field' do
9
+ expect(process).to eq([{"foo" => "bar", "bar" => "bar"}])
10
+ end
11
+ end
12
+ end
13
+ end
14
+
1
15
  describe Dap::Filter::FilterFlatten do
2
16
  describe '.process' do
3
17
 
@@ -47,6 +61,20 @@ describe Dap::Filter::FilterExpand do
47
61
  end
48
62
  end
49
63
 
64
+ describe Dap::Filter::FilterMatchRemove do
65
+ describe '.process' do
66
+
67
+ let(:filter) { described_class.new(["foo."]) }
68
+
69
+ context 'with similar keys' do
70
+ let(:process) { filter.process({"foo" => "bar", "foo.blah" => "blah", "foo.bar" => "baz"}) }
71
+ it 'removes the expected keys' do
72
+ expect(process).to eq([{"foo" => "bar"}])
73
+ end
74
+ end
75
+ end
76
+ end
77
+
50
78
  describe Dap::Filter::FilterTransform do
51
79
  describe '.process' do
52
80
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rapid7 Research
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-09 00:00:00.000000000 Z
11
+ date: 2017-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec