yamwow 0.1.3 → 0.1.4
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.
- data/lib/yamwow/response.rb +2 -17
- metadata +21 -10
data/lib/yamwow/response.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require 'csv'
|
2
1
|
require 'hash_flattener'
|
2
|
+
require 'hash_to_csv'
|
3
3
|
|
4
4
|
module YamWow
|
5
5
|
class Response
|
@@ -12,22 +12,7 @@ module YamWow
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def to_csv(options={})
|
15
|
-
|
16
|
-
columns = options[:include]
|
17
|
-
|
18
|
-
unless columns
|
19
|
-
keys = Set.new
|
20
|
-
hashes.each { |h| keys += h.keys }
|
21
|
-
columns = keys.sort
|
22
|
-
end
|
23
|
-
|
24
|
-
exclude_columns = options[:exclude] || []
|
25
|
-
columns = columns.reject { |c1| exclude_columns.index { |c2| c1 =~ c2 } }
|
26
|
-
|
27
|
-
CSV.generate do |csv|
|
28
|
-
csv << columns
|
29
|
-
hashes.each { |h| csv << columns.map { |k| h[k] } }
|
30
|
-
end
|
15
|
+
HashToCsv.to_csv @data, options
|
31
16
|
end
|
32
17
|
|
33
18
|
def parse_template(template)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yamwow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hash_flattener
|
16
|
-
requirement: &
|
16
|
+
requirement: &70274800911540 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - =
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.2.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70274800911540
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: hash_to_csv
|
27
|
+
requirement: &70274800910800 !ruby/object:Gem::Requirement
|
17
28
|
none: false
|
18
29
|
requirements:
|
19
30
|
- - =
|
@@ -21,10 +32,10 @@ dependencies:
|
|
21
32
|
version: 0.1.0
|
22
33
|
type: :runtime
|
23
34
|
prerelease: false
|
24
|
-
version_requirements: *
|
35
|
+
version_requirements: *70274800910800
|
25
36
|
- !ruby/object:Gem::Dependency
|
26
37
|
name: yam
|
27
|
-
requirement: &
|
38
|
+
requirement: &70274800910100 !ruby/object:Gem::Requirement
|
28
39
|
none: false
|
29
40
|
requirements:
|
30
41
|
- - ! '>='
|
@@ -32,10 +43,10 @@ dependencies:
|
|
32
43
|
version: '0'
|
33
44
|
type: :runtime
|
34
45
|
prerelease: false
|
35
|
-
version_requirements: *
|
46
|
+
version_requirements: *70274800910100
|
36
47
|
- !ruby/object:Gem::Dependency
|
37
48
|
name: rspec
|
38
|
-
requirement: &
|
49
|
+
requirement: &70274800909620 !ruby/object:Gem::Requirement
|
39
50
|
none: false
|
40
51
|
requirements:
|
41
52
|
- - ! '>='
|
@@ -43,10 +54,10 @@ dependencies:
|
|
43
54
|
version: '0'
|
44
55
|
type: :development
|
45
56
|
prerelease: false
|
46
|
-
version_requirements: *
|
57
|
+
version_requirements: *70274800909620
|
47
58
|
- !ruby/object:Gem::Dependency
|
48
59
|
name: rspec-mocks
|
49
|
-
requirement: &
|
60
|
+
requirement: &70274800908960 !ruby/object:Gem::Requirement
|
50
61
|
none: false
|
51
62
|
requirements:
|
52
63
|
- - ! '>='
|
@@ -54,7 +65,7 @@ dependencies:
|
|
54
65
|
version: '0'
|
55
66
|
type: :development
|
56
67
|
prerelease: false
|
57
|
-
version_requirements: *
|
68
|
+
version_requirements: *70274800908960
|
58
69
|
description:
|
59
70
|
email: matthew-github@matthewriley.name
|
60
71
|
executables: []
|