active_report 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2abfd6bbd51ccdf36cc4d2a3fd2368232257dd6f
4
+ data.tar.gz: 4cf16ef868d247ecfd7527dcd73e6702ea04ce7f
5
+ SHA512:
6
+ metadata.gz: 08be6fdc02c15262aa3efddbe4950d34e57cb52055f2fc2dc410d1948652609c8b0c5fffc88a60b2d236f7c312de05b9088b4c32c864e487c266703b81553110
7
+ data.tar.gz: a575b60ff7372c9940a4882d6b753a15018dbf622c038a39c46581e8478a3c0fa2ee5a1d7ad92510b0dc91cc1d0f1cdbff875ae198cf19adf53ad66159c2994a
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --order random
2
+ --colour
3
+ --backtrace
4
+ --format progress
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ before_install:
2
+ - sudo apt-get install libxml2-dev
3
+ cache: bundler
4
+ language: ruby
5
+ notifications:
6
+ email:
7
+ recipients:
8
+ - j.gomez@drexed.com
9
+ on_failure: change
10
+ on_success: never
11
+ rvm:
12
+ - ruby-head
13
+ script: 'bundle exec rake'
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in active_report.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Juan Gomez
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # ActiveReport
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'active_report'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install active_report
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/active_report/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'active_report/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "active_report"
8
+ spec.version = ActiveReport::VERSION
9
+ spec.authors = ["Juan Gomez"]
10
+ spec.email = ["j.gomez@drexed.com"]
11
+ spec.summary = %q{Export or import ruby objects to flat files vice versa.}
12
+ spec.description = %q{Export or import data from multiple input formats such as arrays, hashes, and active record or vice versa.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler"
22
+ spec.add_development_dependency "coveralls"
23
+ spec.add_development_dependency "rake"
24
+ spec.add_development_dependency "rspec"
25
+ end
@@ -0,0 +1,36 @@
1
+ class ActiveReport::Array
2
+
3
+ attr_accessor :datum, :headers, :options
4
+
5
+ def initialize(datum, headers: nil, options: {})
6
+ @datum = datum
7
+ @headers = headers
8
+ @options = options
9
+ end
10
+
11
+ def self.export(datum, headers: nil, options: {})
12
+ new(datum, headers: headers, options: options).export
13
+ end
14
+
15
+ def export
16
+ @datum = [].push(@datum).compact unless @datum.first.is_a?(Array)
17
+
18
+ CSV.generate(@options) do |csv|
19
+ csv << @headers unless @headers.nil?
20
+ @datum.each { |data| csv << data }
21
+ end
22
+ end
23
+
24
+ def self.import(datum, headers: nil, options: {})
25
+ new(datum, headers: headers, options: options).import
26
+ end
27
+
28
+ def import
29
+ processed_datum = [].push(@headers).compact
30
+ CSV.foreach(@datum, @options) do |data|
31
+ processed_datum.push(data)
32
+ end
33
+ processed_datum.count < 2 ? processed_datum.flatten : processed_datum
34
+ end
35
+
36
+ end
@@ -0,0 +1,60 @@
1
+ class ActiveReport::Hash
2
+
3
+ attr_accessor :datum, :only, :except, :headers, :options
4
+
5
+ def initialize(datum, only: nil, except: nil, headers: nil, options: {})
6
+ @datum = datum
7
+ @only = only
8
+ @except = except
9
+ @headers = headers
10
+ @options = options
11
+ end
12
+
13
+ def self.export(datum, only: nil, except: nil, headers: nil, options: {})
14
+ new(datum, only: only, except: except, headers: headers, options: options).export
15
+ end
16
+
17
+ def export
18
+ @datum = [].push(@datum).compact unless @datum.is_a?(Array)
19
+ @only = [].push(@only).compact unless @only.is_a?(Array)
20
+ @except = [].push(@except).compact unless @except.is_a?(Array)
21
+
22
+ CSV.generate(@options) do |csv|
23
+ header = @datum.first.dup.keep_if { |k,v| @only.include?(k) } unless @only.empty?
24
+ header = @datum.first.dup.delete_if { |k,v| @except.include?(k) } unless @except.empty?
25
+ csv << (@headers || (header || @datum.first).keys.map { |k| k.to_s.gsub("_", " ").capitalize})
26
+
27
+ @datum.each do |data|
28
+ cell = data.dup.keep_if { |k,v| @only.include?(k) } unless @only.empty?
29
+ cell = data.dup.delete_if { |k,v| @except.include?(k) } unless @except.empty?
30
+ csv << (cell || data).values
31
+ end
32
+ end
33
+ end
34
+
35
+ def self.import(datum, only: nil, except: nil, headers: nil, options: {})
36
+ new(datum, only: only, except: except, headers: headers, options: options).import
37
+ end
38
+
39
+ def import
40
+ return(nil) if @headers.nil?
41
+
42
+ @only = [].push(@only).compact unless @only.is_a?(Array)
43
+ @except = [].push(@except).compact unless @except.is_a?(Array)
44
+
45
+ processed_datum = []
46
+ CSV.foreach(@datum, @options) do |data|
47
+ processed_data = {}
48
+ @headers.each_with_index do |v,i|
49
+ processed_data.store(v.gsub(" ", "_").downcase.to_sym, data.fetch(i, nil) )
50
+ end
51
+
52
+ processed_data.keep_if { |k,v| @only.include?(k) } unless @only.empty?
53
+ processed_data.delete_if { |k,v| @except.include?(k) } unless @except.empty?
54
+
55
+ processed_datum.push(processed_data)
56
+ end
57
+ processed_datum
58
+ end
59
+
60
+ end
@@ -0,0 +1,36 @@
1
+ require "json"
2
+ class ActiveReport::Record
3
+
4
+ attr_accessor :datum, :only, :except, :headers, :options
5
+
6
+ def initialize(datum, only: nil, except: nil, headers: nil, options: {})
7
+ @datum = datum
8
+ @only = only
9
+ @except = except
10
+ @headers = headers
11
+ @options = options
12
+ end
13
+
14
+ def self.export(datum, only: nil, except: nil, headers: nil, options: {})
15
+ new(datum, only: only, except: except, headers: headers, options: options).export
16
+ end
17
+
18
+ def export
19
+ @datum = @datum.is_a?(ActiveRecord::Relation) ? JSON.parse(@datum.to_json).flatten : [].push(@datum.attributes).compact
20
+ @only = (@only.is_a?(Array) ? @only : [].push(@only).compact).map(&:to_s)
21
+ @except = (@except.is_a?(Array) ? @except : [].push(@except).compact).map(&:to_s)
22
+
23
+ CSV.generate(@options) do |csv|
24
+ header = @datum.first.dup.keep_if { |k,v| @only.include?(k) } unless @only.empty?
25
+ header = @datum.first.dup.delete_if { |k,v| @except.include?(k) } unless @except.empty?
26
+ csv << (@headers || (header || @datum.first).keys.map { |k| k.to_s.gsub("_", " ").capitalize})
27
+
28
+ @datum.each do |data|
29
+ cell = data.dup.keep_if { |k,v| @only.include?(k) } unless @only.empty?
30
+ cell = data.dup.delete_if { |k,v| @except.include?(k) } unless @except.empty?
31
+ csv << (cell || data).values
32
+ end
33
+ end
34
+ end
35
+
36
+ end
@@ -0,0 +1,3 @@
1
+ module ActiveReport
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,5 @@
1
+ require "csv"
2
+ require "active_report/version"
3
+ require "active_report/array"
4
+ require "active_report/hash"
5
+ require "active_report/record"
@@ -0,0 +1,104 @@
1
+ require "spec_helper"
2
+
3
+ describe ActiveReport::Array do
4
+
5
+ sample_header = ["Id", "Name", "Speed", "Hp", "Crash safety rated", "Created at"]
6
+ sample_header_alt = ["No.", "Model", "Speed", "Horse Power", "Crash Safety Rated", "Driven On"]
7
+ sample_content = ["1", "Porche", "225", "430", "true", "2014-08-22T20:59:34.000Z"]
8
+ sample_content_alt = [
9
+ ["1", "Ferrari", "235", "630", "true", "2014-08-23T20:59:34.000Z" ],
10
+ ["2", "Lamborghini", "245", "720", "true", "2014-08-24T20:59:34.000Z" ],
11
+ ["3", "Bugatti", "256", "1001", "false", "2014-08-25T20:59:34.000Z" ]
12
+ ]
13
+
14
+ context 'export to csv without headers for an' do
15
+ it 'array of arrays' do
16
+ sample_csv = File.read('spec/sample/multi_headerless.csv')
17
+ constructed_csv = ActiveReport::Array.export(sample_content_alt)
18
+
19
+ expect(constructed_csv).to eq(sample_csv)
20
+ end
21
+
22
+ it 'array' do
23
+ sample_csv = File.read('spec/sample/solo_headerless.csv')
24
+ constructed_csv = ActiveReport::Array.export(sample_content)
25
+
26
+ expect(constructed_csv).to eq(sample_csv)
27
+ end
28
+ end
29
+
30
+ context 'export to csv with headers for an' do
31
+ it 'array of arrays' do
32
+ sample_csv = File.read('spec/sample/multi_headers.csv')
33
+ constructed_csv = ActiveReport::Array.export(sample_content_alt, headers: sample_header_alt)
34
+
35
+ expect(constructed_csv).to eq(sample_csv)
36
+ end
37
+
38
+ it 'array' do
39
+ sample_csv = File.read('spec/sample/solo_headers.csv')
40
+ constructed_csv = ActiveReport::Array.export(sample_content, headers: sample_header_alt)
41
+
42
+ expect(constructed_csv).to eq(sample_csv)
43
+ end
44
+ end
45
+
46
+ context 'export to csv with options for an' do
47
+ it 'array of arrays' do
48
+ sample_csv = File.read('spec/sample/multi_options.csv')
49
+ constructed_csv = ActiveReport::Array.export(sample_content_alt, headers: sample_header, options: { col_sep: ";" })
50
+
51
+ expect(constructed_csv).to eq(sample_csv)
52
+ end
53
+
54
+ it 'array' do
55
+ sample_csv = File.read('spec/sample/solo_options.csv')
56
+ constructed_csv = ActiveReport::Array.export(sample_content, headers: sample_header, options: { col_sep: ";" })
57
+
58
+ expect(constructed_csv).to eq(sample_csv)
59
+ end
60
+ end
61
+
62
+ context 'import csv without headers returns an' do
63
+ it 'array of arrays' do
64
+ constructed_array = ActiveReport::Array.import('spec/sample/multi_headerless.csv')
65
+
66
+ expect(constructed_array).to eq(sample_content_alt)
67
+ end
68
+
69
+ it 'array' do
70
+ constructed_array = ActiveReport::Array.import('spec/sample/solo_headerless.csv')
71
+
72
+ expect(constructed_array).to eq(sample_content)
73
+ end
74
+ end
75
+
76
+ context 'import csv with headers returns an' do
77
+ it 'array of arrays' do
78
+ constructed_array = ActiveReport::Array.import('spec/sample/multi_headerless.csv', headers: sample_header)
79
+
80
+ expect(constructed_array).to eq(sample_content_alt.dup.unshift(sample_header))
81
+ end
82
+
83
+ it 'array' do
84
+ constructed_array = ActiveReport::Array.import('spec/sample/solo_headerless.csv', headers: sample_header)
85
+
86
+ expect(constructed_array).to eq([].push(sample_header).push(sample_content))
87
+ end
88
+ end
89
+
90
+ context 'import csv with options returns an' do
91
+ it 'array of arrays' do
92
+ constructed_array = ActiveReport::Array.import('spec/sample/multi_options.csv', options: { col_sep: ";" })
93
+
94
+ expect(constructed_array).to eq([].push(sample_header).concat(sample_content_alt))
95
+ end
96
+
97
+ it 'array' do
98
+ constructed_array = ActiveReport::Array.import('spec/sample/solo_options.csv', options: { col_sep: ";" })
99
+
100
+ expect(constructed_array).to eq([].push(sample_header).push(sample_content))
101
+ end
102
+ end
103
+
104
+ end
@@ -0,0 +1,154 @@
1
+ require "spec_helper"
2
+
3
+ describe ActiveReport::Hash do
4
+
5
+ sample_header = ["Id", "Name", "Speed", "Hp", "Crash safety rated", "Created at"]
6
+ sample_header_alt = ["No.", "Model", "Speed", "Horse Power", "Crash Safety Rated", "Driven On"]
7
+ sample_content = { id: "1", name: "Porche", speed: "225", hp: "430", crash_safety_rated: "true", created_at: "2014-08-22T20:59:34.000Z" }
8
+ sample_content_alt = [
9
+ { id: "1", name: "Ferrari", speed: "235", hp: "630", crash_safety_rated: "true", created_at: "2014-08-23T20:59:34.000Z" },
10
+ { id: "2", name: "Lamborghini", speed: "245", hp: "720", crash_safety_rated: "true", created_at: "2014-08-24T20:59:34.000Z" },
11
+ { id: "3", name: "Bugatti", speed: "256", hp: "1001", crash_safety_rated: "false", created_at: "2014-08-25T20:59:34.000Z" }
12
+ ]
13
+
14
+ context 'export to csv all data for an' do
15
+ it 'array of hashes' do
16
+ sample_csv = File.read('spec/sample/multi_all.csv')
17
+ constructed_csv = ActiveReport::Hash.export(sample_content_alt)
18
+
19
+ expect(constructed_csv).to eq(sample_csv)
20
+ end
21
+
22
+ it 'hash' do
23
+ sample_csv = File.read('spec/sample/solo_all.csv')
24
+ constructed_csv = ActiveReport::Hash.export(sample_content)
25
+
26
+ expect(constructed_csv).to eq(sample_csv)
27
+ end
28
+ end
29
+
30
+ context 'export to csv only values for an' do
31
+ it 'array of hashes' do
32
+ sample_csv = File.read('spec/sample/multi_only.csv')
33
+ constructed_csv = ActiveReport::Hash.export(sample_content_alt, only: [:id, :name])
34
+
35
+ expect(constructed_csv).to eq(sample_csv)
36
+ end
37
+
38
+ it 'hash' do
39
+ sample_csv = File.read('spec/sample/solo_only.csv')
40
+ constructed_csv = ActiveReport::Hash.export(sample_content, only: :name)
41
+
42
+ expect(constructed_csv).to eq(sample_csv)
43
+ end
44
+ end
45
+
46
+ context 'export to csv except values for an' do
47
+ it 'array of hashes' do
48
+ sample_csv = File.read('spec/sample/multi_except.csv')
49
+ constructed_csv = ActiveReport::Hash.export(sample_content_alt, except: [:id, :name])
50
+
51
+ expect(constructed_csv).to eq(sample_csv)
52
+ end
53
+
54
+ it 'hash' do
55
+ sample_csv = File.read('spec/sample/solo_except.csv')
56
+ constructed_csv = ActiveReport::Hash.export(sample_content, except: :name)
57
+
58
+ expect(constructed_csv).to eq(sample_csv)
59
+ end
60
+ end
61
+
62
+ context 'export to csv with headers for an' do
63
+ it 'array of hashes' do
64
+ sample_csv = File.read('spec/sample/multi_headers.csv')
65
+ constructed_csv = ActiveReport::Hash.export(sample_content_alt, headers: sample_header_alt)
66
+
67
+ expect(constructed_csv).to eq(sample_csv)
68
+ end
69
+
70
+ it 'hash' do
71
+ sample_csv = File.read('spec/sample/solo_headers.csv')
72
+ constructed_csv = ActiveReport::Hash.export(sample_content, headers: sample_header_alt)
73
+
74
+ expect(constructed_csv).to eq(sample_csv)
75
+ end
76
+ end
77
+
78
+ context 'export to csv with options for an' do
79
+ it 'array of hashes' do
80
+ sample_csv = File.read('spec/sample/multi_options.csv')
81
+ constructed_csv = ActiveReport::Hash.export(sample_content_alt, options: { col_sep: ";" })
82
+
83
+ expect(constructed_csv).to eq(sample_csv)
84
+ end
85
+
86
+ it 'hash' do
87
+ sample_csv = File.read('spec/sample/solo_options.csv')
88
+ constructed_csv = ActiveReport::Hash.export(sample_content, options: { col_sep: ";" })
89
+
90
+ expect(constructed_csv).to eq(sample_csv)
91
+ end
92
+ end
93
+
94
+ context 'import csv with headers returns an' do
95
+ it 'array of arrays' do
96
+ constructed_array = ActiveReport::Hash.import('spec/sample/multi_headerless.csv', headers: sample_header)
97
+
98
+ expect(constructed_array).to eq(sample_content_alt)
99
+ end
100
+
101
+ it 'array with a hash' do
102
+ constructed_array = ActiveReport::Hash.import('spec/sample/solo_headerless.csv', headers: sample_header)
103
+
104
+ expect(constructed_array).to eq([].push(sample_content))
105
+ end
106
+ end
107
+
108
+ context 'import csv only values returns an' do
109
+ it 'array of arrays' do
110
+ sample_array = sample_content_alt.dup.map { |v| v.dup.keep_if { |k,v| [:id, :name].include?(k) } }
111
+ constructed_array = ActiveReport::Hash.import('spec/sample/multi_headerless.csv', headers: sample_header, only: [:id, :name])
112
+
113
+ expect(constructed_array).to eq(sample_array)
114
+ end
115
+
116
+ it 'array with a hash' do
117
+ sample_array = sample_content.dup.keep_if { |k,v| [:name].include?(k) }
118
+ constructed_array = ActiveReport::Hash.import('spec/sample/solo_headerless.csv', headers: sample_header, only: :name)
119
+
120
+ expect(constructed_array).to eq([].push(sample_array))
121
+ end
122
+ end
123
+
124
+ context 'import csv except values returns an' do
125
+ it 'array of arrays' do
126
+ sample_array = sample_content_alt.dup.map { |v| v.dup.delete_if { |k,v| [:id, :name].include?(k) } }
127
+ constructed_array = ActiveReport::Hash.import('spec/sample/multi_headerless.csv', headers: sample_header, except: [:id, :name])
128
+
129
+ expect(constructed_array).to eq(sample_array)
130
+ end
131
+
132
+ it 'array with a hash' do
133
+ sample_array = sample_content.dup.delete_if { |k,v| [:name].include?(k) }
134
+ constructed_array = ActiveReport::Hash.import('spec/sample/solo_headerless.csv', headers: sample_header, except: :name)
135
+
136
+ expect(constructed_array).to eq([].push(sample_array))
137
+ end
138
+ end
139
+
140
+ context 'import csv with options returns an' do
141
+ it 'array of hashes' do
142
+ constructed_array = ActiveReport::Hash.import('spec/sample/multi_headerless_options.csv', headers: sample_header, options: { col_sep: ";" })
143
+
144
+ expect(constructed_array).to eq(sample_content_alt)
145
+ end
146
+
147
+ it 'array with a hash' do
148
+ constructed_array = ActiveReport::Hash.import('spec/sample/solo_headerless_options.csv', headers: sample_header, options: { col_sep: ";" })
149
+
150
+ expect(constructed_array).to eq([].push(sample_content))
151
+ end
152
+ end
153
+
154
+ end
@@ -0,0 +1,4 @@
1
+ Id,Name,Speed,Hp,Crash safety rated,Created at
2
+ 1,Ferrari,235,630,true,2014-08-23T20:59:34.000Z
3
+ 2,Lamborghini,245,720,true,2014-08-24T20:59:34.000Z
4
+ 3,Bugatti,256,1001,false,2014-08-25T20:59:34.000Z
@@ -0,0 +1,4 @@
1
+ Speed,Hp,Crash safety rated,Created at
2
+ 235,630,true,2014-08-23T20:59:34.000Z
3
+ 245,720,true,2014-08-24T20:59:34.000Z
4
+ 256,1001,false,2014-08-25T20:59:34.000Z
@@ -0,0 +1,3 @@
1
+ 1,Ferrari,235,630,true,2014-08-23T20:59:34.000Z
2
+ 2,Lamborghini,245,720,true,2014-08-24T20:59:34.000Z
3
+ 3,Bugatti,256,1001,false,2014-08-25T20:59:34.000Z
@@ -0,0 +1,3 @@
1
+ 1;Ferrari;235;630;true;2014-08-23T20:59:34.000Z
2
+ 2;Lamborghini;245;720;true;2014-08-24T20:59:34.000Z
3
+ 3;Bugatti;256;1001;false;2014-08-25T20:59:34.000Z
@@ -0,0 +1,4 @@
1
+ No.,Model,Speed,Horse Power,Crash Safety Rated,Driven On
2
+ 1,Ferrari,235,630,true,2014-08-23T20:59:34.000Z
3
+ 2,Lamborghini,245,720,true,2014-08-24T20:59:34.000Z
4
+ 3,Bugatti,256,1001,false,2014-08-25T20:59:34.000Z
@@ -0,0 +1,4 @@
1
+ Id,Name
2
+ 1,Ferrari
3
+ 2,Lamborghini
4
+ 3,Bugatti
@@ -0,0 +1,4 @@
1
+ Id;Name;Speed;Hp;Crash safety rated;Created at
2
+ 1;Ferrari;235;630;true;2014-08-23T20:59:34.000Z
3
+ 2;Lamborghini;245;720;true;2014-08-24T20:59:34.000Z
4
+ 3;Bugatti;256;1001;false;2014-08-25T20:59:34.000Z
@@ -0,0 +1,2 @@
1
+ Id,Name,Speed,Hp,Crash safety rated,Created at
2
+ 1,Porche,225,430,true,2014-08-22T20:59:34.000Z
@@ -0,0 +1,2 @@
1
+ Id,Speed,Hp,Crash safety rated,Created at
2
+ 1,225,430,true,2014-08-22T20:59:34.000Z
@@ -0,0 +1 @@
1
+ 1,Porche,225,430,true,2014-08-22T20:59:34.000Z
@@ -0,0 +1 @@
1
+ 1;Porche;225;430;true;2014-08-22T20:59:34.000Z
@@ -0,0 +1,2 @@
1
+ No.,Model,Speed,Horse Power,Crash Safety Rated,Driven On
2
+ 1,Porche,225,430,true,2014-08-22T20:59:34.000Z
@@ -0,0 +1,2 @@
1
+ Name
2
+ Porche
@@ -0,0 +1,2 @@
1
+ Id;Name;Speed;Hp;Crash safety rated;Created at
2
+ 1;Porche;225;430;true;2014-08-22T20:59:34.000Z
@@ -0,0 +1,4 @@
1
+ require "coveralls"
2
+ require "active_report"
3
+
4
+ Coveralls.wear!
metadata ADDED
@@ -0,0 +1,149 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: active_report
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Juan Gomez
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: coveralls
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Export or import data from multiple input formats such as arrays, hashes,
70
+ and active record or vice versa.
71
+ email:
72
+ - j.gomez@drexed.com
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".coveralls.yml"
78
+ - ".gitignore"
79
+ - ".rspec"
80
+ - ".travis.yml"
81
+ - Gemfile
82
+ - LICENSE.txt
83
+ - README.md
84
+ - Rakefile
85
+ - active_report.gemspec
86
+ - lib/active_report.rb
87
+ - lib/active_report/array.rb
88
+ - lib/active_report/hash.rb
89
+ - lib/active_report/record.rb
90
+ - lib/active_report/version.rb
91
+ - spec/lib/array_spec.rb
92
+ - spec/lib/hash_spec.rb
93
+ - spec/sample/multi_all.csv
94
+ - spec/sample/multi_except.csv
95
+ - spec/sample/multi_headerless.csv
96
+ - spec/sample/multi_headerless_options.csv
97
+ - spec/sample/multi_headers.csv
98
+ - spec/sample/multi_only.csv
99
+ - spec/sample/multi_options.csv
100
+ - spec/sample/solo_all.csv
101
+ - spec/sample/solo_except.csv
102
+ - spec/sample/solo_headerless.csv
103
+ - spec/sample/solo_headerless_options.csv
104
+ - spec/sample/solo_headers.csv
105
+ - spec/sample/solo_only.csv
106
+ - spec/sample/solo_options.csv
107
+ - spec/spec_helper.rb
108
+ homepage: ''
109
+ licenses:
110
+ - MIT
111
+ metadata: {}
112
+ post_install_message:
113
+ rdoc_options: []
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ requirements: []
127
+ rubyforge_project:
128
+ rubygems_version: 2.4.6
129
+ signing_key:
130
+ specification_version: 4
131
+ summary: Export or import ruby objects to flat files vice versa.
132
+ test_files:
133
+ - spec/lib/array_spec.rb
134
+ - spec/lib/hash_spec.rb
135
+ - spec/sample/multi_all.csv
136
+ - spec/sample/multi_except.csv
137
+ - spec/sample/multi_headerless.csv
138
+ - spec/sample/multi_headerless_options.csv
139
+ - spec/sample/multi_headers.csv
140
+ - spec/sample/multi_only.csv
141
+ - spec/sample/multi_options.csv
142
+ - spec/sample/solo_all.csv
143
+ - spec/sample/solo_except.csv
144
+ - spec/sample/solo_headerless.csv
145
+ - spec/sample/solo_headerless_options.csv
146
+ - spec/sample/solo_headers.csv
147
+ - spec/sample/solo_only.csv
148
+ - spec/sample/solo_options.csv
149
+ - spec/spec_helper.rb