sigadparse 0.0.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 +7 -0
- data/lib/sigadparse.rb +19 -0
- metadata +45 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: beb0e75921a9eed9d28e91b30eea65d8d6a5d310
|
|
4
|
+
data.tar.gz: 264d2671fa4d7e0764790ad531884b07b8242ed6
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 3a1d17462bf3edb53b8f23ea545698c885426c5ba67ea2e816adc70279a0f694c76dd416f02cfa34651abc8437a2ae345eb12708cc689fe0fc19e2df027daa17
|
|
7
|
+
data.tar.gz: c830d508fe7b6eb76a515ab7e6720ed776d6acf7ceb5aa0acd875768efc0a1fabe73322df892a65ba815510ece7551236aabf9f074c5700dfa5f373635c68ba9
|
data/lib/sigadparse.rb
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
class SIGADParse
|
|
4
|
+
def initialize(input, field)
|
|
5
|
+
@input = JSON.parse(input)
|
|
6
|
+
@field = field
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def match
|
|
10
|
+
matcharr = Array.new
|
|
11
|
+
@input.each do |i|
|
|
12
|
+
if i[@field]
|
|
13
|
+
i[:sigads] = i[@field].scan(/(?:US|CA|UK|NZ|AU|us|ca|uk|nz|au)[a-zA-Z]?-\d(?:\w|-|\*){1,6}/)
|
|
14
|
+
matcharr.push(i)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
JSON.pretty_generate(matcharr)
|
|
18
|
+
end
|
|
19
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: sigadparse
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- M. C. McGrath
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-08-03 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Extracts SIGADs from documents
|
|
14
|
+
email: shidash@shidash.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- lib/sigadparse.rb
|
|
20
|
+
homepage: https://github.com/TransparencyToolkit/SIGADParse
|
|
21
|
+
licenses:
|
|
22
|
+
- GPL
|
|
23
|
+
metadata: {}
|
|
24
|
+
post_install_message:
|
|
25
|
+
rdoc_options: []
|
|
26
|
+
require_paths:
|
|
27
|
+
- lib
|
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - '>='
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
34
|
+
requirements:
|
|
35
|
+
- - '>='
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
requirements: []
|
|
39
|
+
rubyforge_project:
|
|
40
|
+
rubygems_version: 2.0.14
|
|
41
|
+
signing_key:
|
|
42
|
+
specification_version: 4
|
|
43
|
+
summary: All your SIGAD are belong to us
|
|
44
|
+
test_files: []
|
|
45
|
+
has_rdoc:
|