dbf 1.2.7 → 1.2.8

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/History.txt CHANGED
@@ -1,3 +1,11 @@
1
+ == 1.2.7
2
+
3
+ * MIT License
4
+
5
+ == 1.2.6
6
+
7
+ * Support for Ruby 1.9.2
8
+
1
9
  == 1.2.5
2
10
 
3
11
  * Remove ruby warning switch
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- :patch: 7
2
+ :patch: 8
3
3
  :major: 1
4
4
  :build:
5
5
  :minor: 2
data/dbf.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dbf}
8
- s.version = "1.2.7"
8
+ s.version = "1.2.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Keith Morrison"]
12
- s.date = %q{2010-07-03}
12
+ s.date = %q{2010-07-15}
13
13
  s.default_executable = %q{dbf}
14
14
  s.description = %q{A small fast library for reading dBase, xBase, Clipper and FoxPro database files.}
15
15
  s.email = %q{keithm@infused.org}
data/lib/dbf/column.rb CHANGED
@@ -48,9 +48,10 @@ module DBF
48
48
  # @param [String] value
49
49
  # @return [Date]
50
50
  def decode_date(value)
51
- unless value.blank?
52
- value.to_date rescue nil
53
- end
51
+ return nil if value.blank?
52
+ value.is_a?(String) ? value.gsub(' ', '0').to_date : value.to_date
53
+ rescue
54
+ nil
54
55
  end
55
56
 
56
57
  # Decode a DateTime value
@@ -189,4 +189,18 @@ describe DBF::Column do
189
189
  end
190
190
  end
191
191
 
192
+ context '#decode_date' do
193
+ before do
194
+ @column = DBF::Column.new "ColumnName", "N", 1, 0
195
+ end
196
+
197
+ it 'is nil if value is blank' do
198
+ @column.decode_date('').should be_nil
199
+ end
200
+
201
+ it 'interperets spaces as zeros' do
202
+ @column.decode_date('2010 715').should == Date.parse('20100715')
203
+ end
204
+ end
205
+
192
206
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbf
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 7
10
- version: 1.2.7
9
+ - 8
10
+ version: 1.2.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Keith Morrison
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-03 00:00:00 -07:00
18
+ date: 2010-07-15 00:00:00 -07:00
19
19
  default_executable: dbf
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency