fasterer-csv 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.1.0
data/fasterer-csv.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fasterer-csv}
8
- s.version = "1.0.0"
8
+ s.version = "1.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mason"]
data/lib/fasterer_csv.rb CHANGED
@@ -108,6 +108,7 @@ module FastererCSV
108
108
  end
109
109
 
110
110
  alias_method :rows, :to_a
111
+ alias_method :merge!, :merge
111
112
 
112
113
  end
113
114
 
@@ -162,7 +163,7 @@ module FastererCSV
162
163
  end
163
164
  end
164
165
 
165
- def merge!(row)
166
+ def merge(row)
166
167
  if row.is_a? Row
167
168
  row.headers.each do |header|
168
169
  self[header] = row[header]
@@ -202,6 +203,7 @@ module FastererCSV
202
203
  alias_method :include?, :key?
203
204
 
204
205
  alias_method :has_value?, :value?
206
+ alias_method :merge!, :merge
205
207
 
206
208
  end
207
209
 
Binary file
@@ -94,7 +94,7 @@ describe "FastererCSV" do
94
94
 
95
95
  before do
96
96
  @data = <<-CSV
97
- a,b,c,d,e,f,g,h,i,j,k,l,m,n
97
+ a,b,c,d,e,f,g,h,i,j,k,l,m,
98
98
  ,,1,1.1,-1,-1.1,1.1.1,~1~,a,~a~,~a~~a~,~a
99
99
  ~~a~,~,~,
100
100
 
@@ -105,12 +105,17 @@ a,b,c,d,e,f,g,h,i,j,k,l,m,n
105
105
  describe "parse" do
106
106
  it "works" do
107
107
  table = FastererCSV.parse(@data)
108
- table.headers.should == [:a, :b, :c,:d,:e,:f,:g,:h,:i,:j,:k,:l,:m,:n]
108
+ table.headers.should == [:a, :b, :c,:d,:e,:f,:g,:h,:i,:j,:k,:l,:m,:_]
109
109
  table.lines.should == 2
110
110
 
111
111
  table[0].should == [nil, nil, "1", "1.1", "-1", "-1.1", "1.1.1", "1", "a", "a", "a~a", "a\n~a", ",", nil]
112
112
  table[1].should == ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "14"]
113
113
 
114
+ row = table[1]
115
+ row.pull(:a, nil, 'd').should == ["0","14","3"]
116
+ row[:b].should == "1"
117
+ row["b"].should == "1"
118
+
114
119
  end
115
120
  end
116
121
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fasterer-csv
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 0
10
- version: 1.0.0
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mason