dap 0.1.12 → 0.1.13

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: 8e63c529a5f21b91618aad9b36cf006e0c06840a
4
- data.tar.gz: 8e617aaa1e936f7202eb6868e2a208f68063190a
3
+ metadata.gz: 10ae22bb408cf78181b05417d5989e6d7596beab
4
+ data.tar.gz: 1ae46bda652b7d9762fc783c405a41f0b283a640
5
5
  SHA512:
6
- metadata.gz: d1bdc26b13fc074c613b44bce2e6bb39e92dde66a2a56e59d7a177a93540754151187048bcc646dd4051e24e80169a8116a12a2d53e7c9cd73a60d2c87debaa3
7
- data.tar.gz: 39fe747078c41e8ea1b0d3458e27187e83d4a30e8d8b1b6b2bd78bf4e407616a4224126d0da280e07c304be692a03048c1d99a60e41c99ac52edf7986143a246
6
+ metadata.gz: 4cbc7962e20e455b61827704fb30aae75e017133b75db1a01a2c78bcfd52bf357684c75eb4e501c779779942d8c7aeb21362bfd392cd0ea76252239a358a5f2e
7
+ data.tar.gz: 8a0580e71ed75bdc907cdedba4666e7001c07e0979c4a8fcb021d5c3be1e4ddb15044a6ab8690fa5962ff501f69b1e4c542c7ba3365616f231fc910c4a934677
@@ -1,6 +1,7 @@
1
1
  require 'digest/sha1'
2
2
  require 'digest/md5'
3
3
  require 'digest/sha2'
4
+ require 'json'
4
5
 
5
6
  module Dap
6
7
  module Filter
@@ -238,6 +239,8 @@ class FilterTransform
238
239
  doc[k] = doc[k].to_s.upcase
239
240
  when 'ascii'
240
241
  doc[k] = doc[k].to_s.gsub(/[\x00-\x1f\x7f-\xff]/n, '')
242
+ when 'json'
243
+ doc[k] = JSON.parse(doc[k].to_s)
241
244
  when 'utf8encode'
242
245
  doc[k] = doc[k].to_s.encode!('UTF-8', invalid: :replace, undef: :replace, replace: '')
243
246
  when 'base64decode'
data/lib/dap/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dap
2
- VERSION = "0.1.12"
2
+ VERSION = "0.1.13"
3
3
  end
@@ -196,6 +196,23 @@ describe Dap::Filter::FilterTransform do
196
196
  end
197
197
  end
198
198
  end
199
+
200
+ context 'json' do
201
+ let(:filter) { described_class.new(['val=json']) }
202
+
203
+ context 'valid json' do
204
+ let(:process) { filter.process({'val' => '{"nested": "1"}'}) }
205
+ it 'is the correct JSON' do
206
+ expect(process).to eq(['val' => { 'nested' => '1' }])
207
+ end
208
+ end
209
+
210
+ context 'invalid json' do
211
+ it 'raises on invalid JSON' do
212
+ expect { filter.process({'val' => '{abc123'}) }.to raise_error(JSON::ParserError)
213
+ end
214
+ end
215
+ end
199
216
  end
200
217
  end
201
218
 
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.1.12
4
+ version: 0.1.13
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-08-22 00:00:00.000000000 Z
11
+ date: 2017-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -253,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
253
253
  version: '0'
254
254
  requirements: []
255
255
  rubyforge_project:
256
- rubygems_version: 2.5.2
256
+ rubygems_version: 2.6.11
257
257
  signing_key:
258
258
  specification_version: 4
259
259
  summary: 'DAP: The Data Analysis Pipeline'