see_as_vee 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +9 -1
- data/README.md +18 -1
- data/lib/see_as_vee/producers/hashes.rb +5 -1
- data/lib/see_as_vee/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0410a1251a8f3d658906cab07df0f3f6504e574d
|
4
|
+
data.tar.gz: 18017fbe9ec584115ba2fd657cbf4b74e9fc7478
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffd9932a79b1382e7ff8980f18487b7fb4c1a880e715f3f7fdc7c4fc5556a4ce785270e1c9eba3dcb07b3ab9c1d84bfb684f2e4d2bb2ad31ee745200892195bb
|
7
|
+
data.tar.gz: 863c25f7e2f5409e7245d384f88383d7ec9f723111983fd9574ef45db5cacf98c30b9b2ca78b17bad305635018d07f5baf18135f39432f24188749197578bf11
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2017-01-16 15:
|
3
|
+
# on 2017-01-16 15:57:05 +0100 using RuboCop version 0.42.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -14,6 +14,14 @@ Style/AlignParameters:
|
|
14
14
|
Exclude:
|
15
15
|
- 'spec/see_as_vee_spec.rb'
|
16
16
|
|
17
|
+
# Offense count: 2
|
18
|
+
# Cop supports --auto-correct.
|
19
|
+
# Configuration parameters: PreferredDelimiters.
|
20
|
+
Style/PercentLiteralDelimiters:
|
21
|
+
Exclude:
|
22
|
+
- 'lib/see_as_vee/producers/hashes.rb'
|
23
|
+
- 'spec/producers/hashes_spec.rb'
|
24
|
+
|
17
25
|
# Offense count: 160
|
18
26
|
# Cop supports --auto-correct.
|
19
27
|
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
|
data/README.md
CHANGED
@@ -88,6 +88,23 @@ The returned value is an array of [validation results](http://dry-rb.org/gems/dr
|
|
88
88
|
|
89
89
|
### Expand `GROUP_CONCAT` column
|
90
90
|
|
91
|
+
From the version `0.4.6` we support expanding the column given as an `Array` instance
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
▶ require 'see_as_vee'
|
95
|
+
#⇒ true
|
96
|
+
▶ SeeAsVee.csv(
|
97
|
+
▷ [{name: 'Aleksei', value: 42, nicks: %w|matiushkin mudasobwa am-kantox|},
|
98
|
+
▷ {name: 'Saverio', value: 3.14, nicks: %w|trioni rewritten saverio-kantox|}],
|
99
|
+
▷ ungroup: :nicks)
|
100
|
+
#⇒ #<File:/tmp/am/see_as_vee20161109-6031-6he5m7.csv>
|
101
|
+
# -rw------- 1 am am 32 nov 9 07:18 /tmp/am/see_as_vee20161109-6031-6he5m7.csv
|
102
|
+
▶ .cat /tmp/am/see_as_vee20161109-6031-6he5m7.csv
|
103
|
+
#⇒ name value nick 1 nick 2 nick 3
|
104
|
+
# Aleksei 42 matiushkin mudasobwa am-kantox
|
105
|
+
# Saverio 3.14 trioni rewritten saverio-kantox
|
106
|
+
```
|
107
|
+
|
91
108
|
From the version `0.4.5` we support expanding the column produced by `GROUP_CONCAT`
|
92
109
|
|
93
110
|
```ruby
|
@@ -96,7 +113,7 @@ From the version `0.4.5` we support expanding the column produced by `GROUP_CONC
|
|
96
113
|
▶ SeeAsVee.csv(
|
97
114
|
▷ [{name: 'Aleksei', value: 42, nicks: 'matiushkin,mudasobwa,am-kantox'},
|
98
115
|
▷ {name: 'Saverio', value: 3.14, nicks: 'trioni,rewritten,saverio-kantox'}],
|
99
|
-
▷
|
116
|
+
▷ ungroup: :nicks)
|
100
117
|
#⇒ #<File:/tmp/am/see_as_vee20161109-6031-6he5m7.csv>
|
101
118
|
# -rw------- 1 am am 32 nov 9 07:18 /tmp/am/see_as_vee20161109-6031-6he5m7.csv
|
102
119
|
▶ .cat /tmp/am/see_as_vee20161109-6031-6he5m7.csv
|
@@ -61,7 +61,11 @@ module SeeAsVee
|
|
61
61
|
hashes.tap do |hs|
|
62
62
|
hs.each do |hash|
|
63
63
|
columns.each do |column|
|
64
|
-
hash.delete(column)
|
64
|
+
case c = hash.delete(column)
|
65
|
+
when Array then c
|
66
|
+
when String then c.split(delimiter)
|
67
|
+
else [c.inspect]
|
68
|
+
end.each.with_index(1) do |value, idx|
|
65
69
|
hash["#{column}_#{idx}"] = value
|
66
70
|
end
|
67
71
|
end
|
data/lib/see_as_vee/version.rb
CHANGED