csv_monster 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/csv_monster/version.rb +1 -1
- data/lib/csv_monster.rb +5 -4
- data/spec/csv_monster_spec.rb +4 -0
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/lib/csv_monster/version.rb
CHANGED
data/lib/csv_monster.rb
CHANGED
@@ -41,11 +41,12 @@ class CSVMonster
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def split split_count
|
44
|
-
header, *
|
44
|
+
header, *entries = self.content
|
45
45
|
splits = []
|
46
46
|
|
47
|
-
|
48
|
-
if (i % (
|
47
|
+
entries.each_with_index do |row, i|
|
48
|
+
if (i % (entries.length / split_count)).zero? &&
|
49
|
+
split_count > splits.length
|
49
50
|
splits << self.class.new
|
50
51
|
splits.last.content << header
|
51
52
|
end
|
@@ -64,7 +65,7 @@ class CSVMonster
|
|
64
65
|
end
|
65
66
|
end
|
66
67
|
|
67
|
-
|
68
|
+
outfile
|
68
69
|
end
|
69
70
|
|
70
71
|
private
|
data/spec/csv_monster_spec.rb
CHANGED
@@ -205,6 +205,10 @@ describe CSVMonster do
|
|
205
205
|
|
206
206
|
subject { csv_monster.write! outfile }
|
207
207
|
|
208
|
+
it "returns the file path it wrote to" do
|
209
|
+
expect(subject).to eq outfile
|
210
|
+
end
|
211
|
+
|
208
212
|
it "writes the file to the specified location" do
|
209
213
|
expect(File.exists? outfile).to be_false
|
210
214
|
subject
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csv_monster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
version: '0'
|
89
89
|
requirements: []
|
90
90
|
rubyforge_project:
|
91
|
-
rubygems_version: 1.8.
|
91
|
+
rubygems_version: 1.8.24
|
92
92
|
signing_key:
|
93
93
|
specification_version: 3
|
94
94
|
summary: A monster of a CSV util
|