loady 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- loady (0.2.1)
4
+ loady (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -14,11 +14,13 @@ class Array
14
14
 
15
15
  names.each_with_index do |name, i|
16
16
  if i < self.size
17
- if options[:strip]
17
+ if options[:strip] && self[i]
18
18
  h[name] = self[i].strip
19
19
  else
20
20
  h[name] = self[i]
21
21
  end
22
+ else
23
+ h[name] = nil
22
24
  end
23
25
  end
24
26
 
@@ -1,3 +1,3 @@
1
1
  module Loady
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -3,13 +3,13 @@
3
3
  Albert,1948,note: everything is read as a string whether it is quoted or not
4
4
  Koko,1971
5
5
  Curious George,1941
6
- blah.......
6
+ blah.......,
7
7
  ",,,,,,,,,,,,,,,,,,,,this is a bad row because of the quote
8
8
  ",,,,,,,,,,,",,,/"\",,,,,,this is a bad row too
9
9
 
10
10
  " blank rows are skipped, this is bad though
11
11
 
12
12
  Bear,1980,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"this is ok"
13
- Mighty Joe Young,1998
13
+ Mighty Joe Young
14
14
  Donkey Kong,1981
15
15
  King Kong,1933
@@ -17,9 +17,10 @@ class LoadyTest < Test::Unit::TestCase
17
17
  row = ['Bubbles ', '2000']
18
18
  attrs = row.to_attributes [:name, :year, :mom]
19
19
 
20
- assert_equal attrs.size, 2
20
+ assert_equal attrs.size, 3
21
21
  assert_equal attrs[:name], 'Bubbles'
22
22
  assert_equal attrs[:year], '2000'
23
+ assert_nil attrs[:mom]
23
24
  end
24
25
 
25
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loady
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-16 00:00:00.000000000 Z
12
+ date: 2011-12-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-unit
16
- requirement: &2152353540 !ruby/object:Gem::Requirement
16
+ requirement: &2153048400 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2152353540
24
+ version_requirements: *2153048400
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: shoulda
27
- requirement: &2152352480 !ruby/object:Gem::Requirement
27
+ requirement: &2153047980 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2152352480
35
+ version_requirements: *2153047980
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &2152351920 !ruby/object:Gem::Requirement
38
+ requirement: &2153047560 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2152351920
46
+ version_requirements: *2153047560
47
47
  description: CSV file loader with simple logging
48
48
  email:
49
49
  - tee@stackpilot.com