jsoncombiner 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/jsoncombiner.rb +8 -9
  2. metadata +2 -2
@@ -1,11 +1,5 @@
1
1
  require 'json'
2
2
 
3
- # Make gem
4
- # Git repository
5
- # Add to TT
6
- # Fields to choose steps to combine
7
- # Handling for getting input from steps
8
-
9
3
  class JSONCombiner
10
4
  def initialize(*inputjsons)
11
5
  @inputjsons = inputjsons
@@ -15,10 +9,15 @@ class JSONCombiner
15
9
  def concatenate
16
10
  savearray = Array.new
17
11
  @inputjsons.each do |j|
18
- savearray = savearray + JSON.parse(j)
12
+ nextfile = JSON.parse(j)
13
+
14
+ nextfile.each do |h|
15
+ if !(savearray.include? h)
16
+ savearray.push(h)
17
+ end
18
+ end
19
19
  end
20
20
 
21
- return savearray.to_json
21
+ return JSON.pretty_generate(savearray)
22
22
  end
23
23
  end
24
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsoncombiner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-19 00:00:00.000000000 Z
12
+ date: 2014-02-28 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Input multiple JSONs, get back one with all the data
15
15
  email: shidash@shidash.com