dbf 4.1.5 → 4.2.1

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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +164 -108
  3. data/Gemfile.lock +43 -40
  4. data/README.md +18 -17
  5. data/Rakefile +1 -1
  6. data/ci_A.dbf +0 -0
  7. data/lib/dbf/column.rb +3 -3
  8. data/lib/dbf/column_type.rb +9 -12
  9. data/lib/dbf/table.rb +17 -8
  10. data/lib/dbf/version.rb +1 -1
  11. data/nBOOKS.DBF +0 -0
  12. data/spec/dbf/column_spec.rb +3 -3
  13. data/spec/dbf/file_formats_spec.rb +36 -0
  14. data/spec/fixtures/dbase_02_summary.txt +23 -0
  15. data/spec/fixtures/dbase_32.dbf +0 -0
  16. data/spec/fixtures/dbase_32_summary.txt +11 -0
  17. data/spec/fixtures/dbase_8c.dbf +0 -0
  18. metadata +10 -52
  19. data/Gemfile.travis +0 -8
  20. data/docs/CNAME +0 -1
  21. data/docs/DBF/Column/LengthError.html +0 -124
  22. data/docs/DBF/Column/NameError.html +0 -124
  23. data/docs/DBF/Column.html +0 -947
  24. data/docs/DBF/ColumnType/Base.html +0 -389
  25. data/docs/DBF/ColumnType/Boolean.html +0 -238
  26. data/docs/DBF/ColumnType/Currency.html +0 -238
  27. data/docs/DBF/ColumnType/Date.html +0 -242
  28. data/docs/DBF/ColumnType/DateTime.html +0 -246
  29. data/docs/DBF/ColumnType/Double.html +0 -238
  30. data/docs/DBF/ColumnType/Float.html +0 -238
  31. data/docs/DBF/ColumnType/General.html +0 -238
  32. data/docs/DBF/ColumnType/Memo.html +0 -246
  33. data/docs/DBF/ColumnType/Nil.html +0 -238
  34. data/docs/DBF/ColumnType/Number.html +0 -242
  35. data/docs/DBF/ColumnType/SignedLong.html +0 -238
  36. data/docs/DBF/ColumnType/String.html +0 -240
  37. data/docs/DBF/ColumnType.html +0 -115
  38. data/docs/DBF/Database/Foxpro.html +0 -653
  39. data/docs/DBF/Database/Table.html +0 -346
  40. data/docs/DBF/Database.html +0 -126
  41. data/docs/DBF/FileNotFoundError.html +0 -124
  42. data/docs/DBF/Header.html +0 -723
  43. data/docs/DBF/Memo/Base.html +0 -485
  44. data/docs/DBF/Memo/Dbase3.html +0 -242
  45. data/docs/DBF/Memo/Dbase4.html +0 -230
  46. data/docs/DBF/Memo/Foxpro.html +0 -268
  47. data/docs/DBF/Memo.html +0 -117
  48. data/docs/DBF/NoColumnsDefined.html +0 -124
  49. data/docs/DBF/Record.html +0 -773
  50. data/docs/DBF/Schema.html +0 -980
  51. data/docs/DBF/Table.html +0 -1571
  52. data/docs/DBF.html +0 -200
  53. data/docs/_index.html +0 -415
  54. data/docs/class_list.html +0 -51
  55. data/docs/css/common.css +0 -1
  56. data/docs/css/full_list.css +0 -58
  57. data/docs/css/style.css +0 -497
  58. data/docs/file.README.html +0 -359
  59. data/docs/file_list.html +0 -56
  60. data/docs/frames.html +0 -17
  61. data/docs/index.html +0 -359
  62. data/docs/js/app.js +0 -314
  63. data/docs/js/full_list.js +0 -216
  64. data/docs/js/jquery.js +0 -4
  65. data/docs/method_list.html +0 -675
  66. data/docs/top-level-namespace.html +0 -110
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68d5e427f28ed4ecfe46703031af46cb8edfa4cd3781f5e1fc8393c505d6286c
4
- data.tar.gz: fa0f6ff80840de09eed5216ac8b02126c8cd396fc385e880c11e7a6e9a56bf3f
3
+ metadata.gz: '018bddbea260f8bb7bbdb218a6601746377f9e07c68fb5785c2c03d39e9d1dfe'
4
+ data.tar.gz: 9c906f4f7d62016d88d13e56f3565a2b1dfb387c1dabd013cde2bfc6eeb30b5d
5
5
  SHA512:
6
- metadata.gz: f185690b99273879ef6d7222da8a0c85005edced9b5ee5a9b7fcf0775f786e3937f159bd82e2a47fafcd42d91cd60dc0fdb6b94550a67b1818b12b4beb60cfb5
7
- data.tar.gz: 2bf490dba96e63910e998eea1fd4892ee97440698ec84f210e58b73502948c00cc2be1de6f89e2010e6a6d4ca0e4271af786f9b7ed38f86fab98d0fcc1a7a49e
6
+ metadata.gz: 912b2de5a0c39ba4b5ddbfdc815a13e0c59f252d1f4f4ec821246ead6a72da764bd3b2ee29a7c77feda5db6c6e5f2a7e9431c24abdee920691e04822c061541d
7
+ data.tar.gz: 625a7f42e67cc0c52a40610ca5d65d397e93bd232fd6a08ac1d07773e915720720658e21279b085aed63a3d83adaa7dea55baf8be8985305bcc3b7de93abfd00
data/CHANGELOG.md CHANGED
@@ -1,159 +1,215 @@
1
- # 4.1.5
2
- - Better handling for PIPE errors when using command line utility
1
+ # Changelog
3
2
 
4
- # 4.1.4
5
- - Add full support for FoxBase files
3
+ ## 4.2.0
6
4
 
7
- # 4.1.3
8
- - Raise DBF::NoColumnsDefined error when attempting to read records if no columns are defined
5
+ - Initial support for dBase 7 files
9
6
 
10
- # 4.1.1
11
- - Add required_ruby_version to gemspec
7
+ ## 4.1.6
12
8
 
13
- # 4.1.0
14
- - Return Time instead of DateTime
9
+ - Add support for file type 32
15
10
 
16
- # 4.0.0
17
- - Drop support for ruby-2.2 and earlier
11
+ ## 4.1.5
18
12
 
19
- # 3.1.3
20
- - Ensure malformed dates return nil
13
+ - Better handling for PIPE errors when using command line utility
21
14
 
22
- # 3.1.2
23
- - Fix incorrect columns list when StringIO and encoding set
15
+ ## 4.1.4
24
16
 
25
- # 3.1.1
26
- - Use Date.strptime to parse date fields
17
+ - Add full support for FoxBase files
27
18
 
28
- # 3.1.0
29
- - Use :binary for binary fields in ActiveRecord schemas
19
+ ## 4.1.3
30
20
 
31
- # 3.0.8
32
- - Fix uninitialized constant error under Rails 5
21
+ - Raise DBF::NoColumnsDefined error when attempting to read records if no columns are defined
33
22
 
34
- # 3.0.7
35
- - Ignore non-existent records if header record count is incorrect
23
+ ## 4.1.1
36
24
 
37
- # 3.0.6
38
- - This version has been yanked from rubygems due to errors
25
+ - Add required_ruby_version to gemspec
39
26
 
40
- # 3.0.5
41
- - Override table name for schema output
27
+ ## 4.1.0
42
28
 
43
- # 3.0.4
44
- - Adds -v command-line option to print version
45
- - Adds -r command-line option to create Sequel migration
29
+ - Return Time instead of DateTime
46
30
 
47
- # 3.0.3
48
- - Uninitialized (N)umbers should return nil
31
+ ## 4.0.0
49
32
 
50
- # 3.0.2
51
- - Performance improvements for large files
33
+ - Drop support for ruby-2.2 and earlier
52
34
 
53
- # 3.0.1
54
- - Support FoxPro (G) general field type
55
- - Fix ruby warnings
35
+ ## 3.1.3
56
36
 
57
- # 3.0.0
58
- - Requires Ruby version 2.0 and above
59
- - Support the (G) General Foxpro field type
37
+ - Ensure malformed dates return nil
60
38
 
61
- # 2.0.13
62
- - Support 64-bit currency signed currency values
63
- (see https://github.com/infused/dbf/pull/71)
39
+ ## 3.1.2
64
40
 
65
- # 2.0.12
66
- - Parse (I) values as signed
67
- (see https://github.com/infused/dbf/pull/70)
41
+ - Fix incorrect columns list when StringIO and encoding set
68
42
 
69
- # 2.0.11
70
- - Foxpro doubles should always return the full stored precision
71
- (see https://github.com/infused/dbf/pull/69)
43
+ ## 3.1.1
72
44
 
73
- # 2.0.10
74
- - allow 0 length fields, but always return nil as value
45
+ - Use Date.strptime to parse date fields
75
46
 
76
- # 2.0.9
77
- - fix dBase IV attributes when memo file is missing
47
+ ## 3.1.0
78
48
 
79
- # 2.0.8
80
- - fix FoxPro currency fields on some builds of Ruby 1.9.3 and 2.0.0
49
+ - Use :binary for binary fields in ActiveRecord schemas
81
50
 
82
- # 2.0.7
83
- - fix the dbf binary on some linux systems
51
+ ## 3.0.8
84
52
 
85
- # 2.0.6
86
- - build_memo returns nil on errors
53
+ - Fix uninitialized constant error under Rails 5
87
54
 
88
- # 2.0.5
89
- - use correct FoxPro memo block size
55
+ ## 3.0.7
90
56
 
91
- # 2.0.4
92
- - memo fields return nil if memo file is missing
57
+ - Ignore non-existent records if header record count is incorrect
93
58
 
94
- # 2.0.3
95
- - set encoding if table encoding is nil
59
+ ## 3.0.6
96
60
 
97
- # 2.0.2
98
- - Allow overriding the character encoding specified in the file
61
+ - This version has been yanked from rubygems due to errors
99
62
 
100
- # 2.0.1
101
- - Add experimental support for character encodings under Ruby 1.8
63
+ ## 3.0.5
102
64
 
103
- # 2.0.0
104
- - #44 Require FasterCSV gem on all platforms
105
- - Remove rdoc development dependency
106
- - #42 Fixes encoding of memos
107
- - #43 Improve handling of record attributes
65
+ - Override table name for schema output
108
66
 
109
- # 1.7.5
110
- - fixes FoxPro currency (Y) fields
67
+ ## 3.0.4
111
68
 
112
- # 1.7.4
113
- - Replace Memo Type with Memo File boolean in command-line utility summary output
69
+ - Adds -v command-line option to print version
70
+ - Adds -r command-line option to create Sequel migration
114
71
 
115
- # 1.7.3
116
- - find_all/find_first should ignore deleted records
72
+ ## 3.0.3
117
73
 
118
- # 1.7.2
119
- - Fix integer division under Ruby 1.8 when requiring mathn
120
- standard library (see http://bugs.ruby-lang.org/issues/2121)
74
+ - Uninitialized (N)umbers should return nil
121
75
 
122
- # 1.7.1
123
- - Fix Table.FOXPRO_VERSIONS breakage on Ruby 1.8
76
+ ## 3.0.2
77
+
78
+ - Performance improvements for large files
124
79
 
125
- # 1.7.0
126
- - allow DBF::Table to work with dbf data in memory
127
- - allow DBF::Table#to_csv to write to STDOUT
80
+ ## 3.0.1
128
81
 
129
- # 1.6.7
130
- - memo columns return nil when no memo file found
82
+ - Support FoxPro (G) general field type
83
+ - Fix ruby warnings
131
84
 
132
- # 1.6.6
133
- - add binary data type support to ActiveRecord schema output
85
+ ## 3.0.0
134
86
 
135
- # 1.6.5
136
- - support for visual foxpro double (b) data type
87
+ - Requires Ruby version 2.0 and above
88
+ - Support the (G) General Foxpro field type
137
89
 
138
- # 1.6.3
139
- - Replace invalid chars with 'unicode replacement character' (U+FFFD)
90
+ ## 2.0.13
91
+
92
+ - Support 64-bit currency signed currency values
93
+ (see https://github.com/infused/dbf/pull/71)
94
+
95
+ ## 2.0.12
96
+
97
+ - Parse (I) values as signed
98
+ (see https://github.com/infused/dbf/pull/70)
99
+
100
+ ## 2.0.11
101
+
102
+ - Foxpro doubles should always return the full stored precision
103
+ (see https://github.com/infused/dbf/pull/69)
104
+
105
+ ## 2.0.10
106
+
107
+ - allow 0 length fields, but always return nil as value
108
+
109
+ ## 2.0.9
110
+
111
+ - fix dBase IV attributes when memo file is missing
112
+
113
+ ## 2.0.8
114
+
115
+ - fix FoxPro currency fields on some builds of Ruby 1.9.3 and 2.0.0
116
+
117
+ ## 2.0.7
118
+
119
+ - fix the dbf binary on some linux systems
120
+
121
+ ## 2.0.6
122
+
123
+ - build_memo returns nil on errors
124
+
125
+ ## 2.0.5
126
+
127
+ - use correct FoxPro memo block size
128
+
129
+ ## 2.0.4
130
+
131
+ - memo fields return nil if memo file is missing
132
+
133
+ ## 2.0.3
134
+
135
+ - set encoding if table encoding is nil
136
+
137
+ ## 2.0.2
138
+
139
+ - Allow overriding the character encoding specified in the file
140
+
141
+ ## 2.0.1
142
+
143
+ - Add experimental support for character encodings under Ruby 1.8
144
+
145
+ ## 2.0.0
146
+
147
+ - #44 Require FasterCSV gem on all platforms
148
+ - Remove rdoc development dependency
149
+ - #42 Fixes encoding of memos
150
+ - #43 Improve handling of record attributes
151
+
152
+ ## 1.7.5
153
+
154
+ - fixes FoxPro currency (Y) fields
155
+
156
+ ## 1.7.4
157
+
158
+ - Replace Memo Type with Memo File boolean in command-line utility summary output
159
+
160
+ ## 1.7.3
161
+
162
+ - find_all/find_first should ignore deleted records
163
+
164
+ ## 1.7.2
165
+
166
+ - Fix integer division under Ruby 1.8 when requiring mathn
167
+ standard library (see http://bugs.ruby-lang.org/issues/2121)
168
+
169
+ ## 1.7.1
170
+
171
+ - Fix Table.FOXPRO_VERSIONS breakage on Ruby 1.8
172
+
173
+ ## 1.7.0
174
+
175
+ - allow DBF::Table to work with dbf data in memory
176
+ - allow DBF::Table#to_csv to write to STDOUT
177
+
178
+ ## 1.6.7
179
+
180
+ - memo columns return nil when no memo file found
181
+
182
+ ## 1.6.6
183
+
184
+ - add binary data type support to ActiveRecord schema output
185
+
186
+ ## 1.6.5
187
+
188
+ - support for visual foxpro double (b) data type
189
+
190
+ ## 1.6.3
191
+
192
+ - Replace invalid chars with 'unicode replacement character' (U+FFFD)
140
193
 
141
194
  ## 1.6.2
142
- - add Table#filename method
143
- - Rakefile now loads gems with bundler
144
- - add Table#supports_encoding?
145
- - simplify encodings.yml loader
146
- - add rake and rdoc as development dependencies
147
- - simplify open_memo file search logic
148
- - remove unnecessary requires in spec helper
149
- - fix cli summary
195
+
196
+ - add Table#filename method
197
+ - Rakefile now loads gems with bundler
198
+ - add Table#supports_encoding?
199
+ - simplify encodings.yml loader
200
+ - add rake and rdoc as development dependencies
201
+ - simplify open_memo file search logic
202
+ - remove unnecessary requires in spec helper
203
+ - fix cli summary
150
204
 
151
205
  ## 1.6.1
152
- - fix YAML issue when using MRI version > 1.9.1
153
- - remove Table#seek_to_index and Table#current_record private methods
206
+
207
+ - fix YAML issue when using MRI version > 1.9.1
208
+ - remove Table#seek_to_index and Table#current_record private methods
154
209
 
155
210
  ## 1.6.0
156
- - remove activesupport gem dependency
211
+
212
+ - remove activesupport gem dependency
157
213
 
158
214
  ## 1.5.0
159
215
 
data/Gemfile.lock CHANGED
@@ -1,19 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dbf (4.1.4)
4
+ dbf (4.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  ast (2.4.2)
10
10
  awesome_print (1.9.2)
11
+ benchmark (0.2.0)
11
12
  byebug (11.1.3)
12
13
  coderay (1.1.3)
13
- diff-lcs (1.4.4)
14
+ diff-lcs (1.5.0)
14
15
  e2mmap (0.1.0)
15
- ffi (1.15.3)
16
- formatador (0.3.0)
16
+ ffi (1.15.5)
17
+ formatador (1.1.0)
17
18
  guard (2.18.0)
18
19
  formatador (>= 0.2.4)
19
20
  listen (>= 2.7, < 4.0)
@@ -28,10 +29,10 @@ GEM
28
29
  guard (~> 2.1)
29
30
  guard-compat (~> 1.1)
30
31
  rspec (>= 2.99.0, < 4.0)
31
- io-console (0.5.9)
32
- irb (1.3.6)
33
- reline (>= 0.2.5)
34
- listen (3.6.0)
32
+ io-console (0.5.11)
33
+ irb (1.4.1)
34
+ reline (>= 0.3.0)
35
+ listen (3.7.1)
35
36
  rb-fsevent (~> 0.10, >= 0.10.3)
36
37
  rb-inotify (~> 0.9, >= 0.9.10)
37
38
  lumberjack (1.2.8)
@@ -40,62 +41,64 @@ GEM
40
41
  notiffany (0.1.3)
41
42
  nenv (~> 0.1)
42
43
  shellany (~> 0.0)
43
- parallel (1.20.1)
44
- parser (3.0.2.0)
44
+ parallel (1.22.1)
45
+ parser (3.1.2.0)
45
46
  ast (~> 2.4.1)
46
47
  pry (0.14.1)
47
48
  coderay (~> 1.1)
48
49
  method_source (~> 1.0)
49
- rainbow (3.0.0)
50
+ rainbow (3.1.1)
50
51
  rake (13.0.6)
51
- rb-fsevent (0.11.0)
52
+ rb-fsevent (0.11.1)
52
53
  rb-inotify (0.10.1)
53
54
  ffi (~> 1.0)
54
- regexp_parser (2.1.1)
55
- reline (0.2.6)
55
+ regexp_parser (2.5.0)
56
+ reline (0.3.1)
56
57
  io-console (~> 0.5)
57
58
  rexml (3.2.5)
58
- rspec (3.10.0)
59
- rspec-core (~> 3.10.0)
60
- rspec-expectations (~> 3.10.0)
61
- rspec-mocks (~> 3.10.0)
62
- rspec-core (3.10.1)
63
- rspec-support (~> 3.10.0)
64
- rspec-expectations (3.10.1)
59
+ rspec (3.11.0)
60
+ rspec-core (~> 3.11.0)
61
+ rspec-expectations (~> 3.11.0)
62
+ rspec-mocks (~> 3.11.0)
63
+ rspec-core (3.11.0)
64
+ rspec-support (~> 3.11.0)
65
+ rspec-expectations (3.11.0)
65
66
  diff-lcs (>= 1.2.0, < 2.0)
66
- rspec-support (~> 3.10.0)
67
- rspec-mocks (3.10.2)
67
+ rspec-support (~> 3.11.0)
68
+ rspec-mocks (3.11.1)
68
69
  diff-lcs (>= 1.2.0, < 2.0)
69
- rspec-support (~> 3.10.0)
70
- rspec-support (3.10.2)
71
- rubocop (1.18.4)
70
+ rspec-support (~> 3.11.0)
71
+ rspec-support (3.11.0)
72
+ rubocop (1.30.1)
72
73
  parallel (~> 1.10)
73
- parser (>= 3.0.0.0)
74
+ parser (>= 3.1.0.0)
74
75
  rainbow (>= 2.2.2, < 4.0)
75
76
  regexp_parser (>= 1.8, < 3.0)
76
- rexml
77
- rubocop-ast (>= 1.8.0, < 2.0)
77
+ rexml (>= 3.2.5, < 4.0)
78
+ rubocop-ast (>= 1.18.0, < 2.0)
78
79
  ruby-progressbar (~> 1.7)
79
80
  unicode-display_width (>= 1.4.0, < 3.0)
80
- rubocop-ast (1.9.0)
81
- parser (>= 3.0.1.1)
82
- rubocop-performance (1.11.4)
81
+ rubocop-ast (1.18.0)
82
+ parser (>= 3.1.1.0)
83
+ rubocop-performance (1.14.2)
83
84
  rubocop (>= 1.7.0, < 2.0)
84
85
  rubocop-ast (>= 0.4.0)
85
- rubocop-rspec (2.4.0)
86
- rubocop (~> 1.0)
87
- rubocop-ast (>= 1.1.0)
86
+ rubocop-rspec (2.11.1)
87
+ rubocop (~> 1.19)
88
88
  ruby-progressbar (1.11.0)
89
89
  shellany (0.0.1)
90
- thor (1.1.0)
91
- unicode-display_width (2.0.0)
92
- yard (0.9.26)
90
+ thor (1.2.1)
91
+ unicode-display_width (2.1.0)
92
+ webrick (1.7.0)
93
+ yard (0.9.28)
94
+ webrick (~> 1.7.0)
93
95
 
94
96
  PLATFORMS
95
- ruby
97
+ arm64-darwin-21
96
98
 
97
99
  DEPENDENCIES
98
100
  awesome_print
101
+ benchmark
99
102
  byebug
100
103
  dbf!
101
104
  e2mmap
@@ -110,4 +113,4 @@ DEPENDENCIES
110
113
  yard
111
114
 
112
115
  BUNDLED WITH
113
- 1.17.3
116
+ 2.3.16
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # DBF
2
2
  [![Version](https://img.shields.io/gem/v/dbf.svg?style=flat)](https://rubygems.org/gems/dbf)
3
- [![Build Status](https://img.shields.io/travis/infused/dbf/master.svg?style=flat)](https://travis-ci.com/infused/dbf)
3
+ [![Build Status](https://github.com/infused/dbf/actions/workflows/build.yml/badge.svg)](https://github.com/infused/dbf/actions/workflows/build.yml)
4
4
  [![Code Quality](https://img.shields.io/codeclimate/maintainability/infused/dbf.svg?style=flat)](https://codeclimate.com/github/infused/dbf)
5
5
  [![Code Coverage](https://img.shields.io/codeclimate/c/infused/dbf.svg?style=flat)](https://codeclimate.com/github/infused/dbf)
6
6
  [![Total Downloads](https://img.shields.io/gem/dt/dbf.svg)](https://rubygems.org/gems/dbf/)
@@ -324,22 +324,23 @@ at this time.
324
324
 
325
325
  ### Supported data types by dBase version
326
326
 
327
- | Version | Description | C | N | L | D | M | F | B | G | P | Y | T | I | V | X | @ | O | + |
328
- |---------|-----------------------------------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
329
- | 02 | FoxBase | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - | - | - |
330
- | 03 | dBase III without memo file | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - | - | - |
331
- | 04 | dBase IV without memo file | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - | - | - |
332
- | 05 | dBase V without memo file | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - | - | - |
333
- | 07 | Visual Objects 1.x | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - | - | - |
334
- | 30 | Visual FoxPro | Y | Y | Y | Y | Y | Y | Y | Y | N | Y | N | Y | N | N | N | N | - |
335
- | 31 | Visual FoxPro with AutoIncrement | Y | Y | Y | Y | Y | Y | Y | Y | N | Y | N | Y | N | N | N | N | N |
336
- | 7b | dBase IV with memo file | Y | Y | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - |
337
- | 83 | dBase III with memo file | Y | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - | - |
338
- | 87 | Visual Objects 1.x with memo file | Y | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - | - |
339
- | 8b | dBase IV with memo file | Y | Y | Y | Y | Y | - | - | - | - | - | - | - | - | N | - | - | - |
340
- | 8e | dBase IV with SQL table | Y | Y | Y | Y | Y | - | - | - | - | - | - | - | - | N | - | - | - |
341
- | f5 | FoxPro with memo file | Y | Y | Y | Y | Y | Y | Y | Y | N | Y | N | Y | N | N | N | N | N |
342
- | fb | FoxPro without memo file | Y | Y | Y | Y | - | Y | Y | Y | N | Y | N | Y | N | N | N | N | N |
327
+ | Version | Description | C | N | L | D | M | F | B | G | P | Y | T | I | V | X | @ | O | + |
328
+ |---------|-----------------------------------------------------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
329
+ | 02 | FoxBase | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - | - | - |
330
+ | 03 | dBase III without memo file | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - | - | - |
331
+ | 04 | dBase IV without memo file | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - | - | - |
332
+ | 05 | dBase V without memo file | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - | - | - |
333
+ | 07 | Visual Objects 1.x | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - | - | - |
334
+ | 30 | Visual FoxPro | Y | Y | Y | Y | Y | Y | Y | Y | N | Y | N | Y | N | N | N | N | - |
335
+ | 31 | Visual FoxPro with AutoIncrement | Y | Y | Y | Y | Y | Y | Y | Y | N | Y | N | Y | N | N | N | N | N |
336
+ | 32 | Visual FoxPro with field type Varchar or Varbinary | Y | Y | Y | Y | Y | Y | Y | Y | N | Y | N | Y | N | N | N | N | N |
337
+ | 7b | dBase IV with memo file | Y | Y | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - |
338
+ | 83 | dBase III with memo file | Y | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - | - |
339
+ | 87 | Visual Objects 1.x with memo file | Y | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - | - |
340
+ | 8b | dBase IV with memo file | Y | Y | Y | Y | Y | - | - | - | - | - | - | - | - | N | - | - | - |
341
+ | 8e | dBase IV with SQL table | Y | Y | Y | Y | Y | - | - | - | - | - | - | - | - | N | - | - | - |
342
+ | f5 | FoxPro with memo file | Y | Y | Y | Y | Y | Y | Y | Y | N | Y | N | Y | N | N | N | N | N |
343
+ | fb | FoxPro without memo file | Y | Y | Y | Y | - | Y | Y | Y | N | Y | N | Y | N | N | N | N | N |
343
344
 
344
345
  Data type descriptions
345
346
 
data/Rakefile CHANGED
@@ -14,5 +14,5 @@ task default: :spec
14
14
 
15
15
  desc 'Open an irb session preloaded with this library'
16
16
  task :console do
17
- sh 'irb -rubygems -I lib -r dbf.rb'
17
+ sh 'irb -r rubygems -I lib -r dbf.rb'
18
18
  end
data/ci_A.dbf ADDED
Binary file
data/lib/dbf/column.rb CHANGED
@@ -21,7 +21,8 @@ module DBF
21
21
  L: ColumnType::Boolean,
22
22
  M: ColumnType::Memo,
23
23
  B: ColumnType::Double,
24
- G: ColumnType::General
24
+ G: ColumnType::General,
25
+ '+'.to_sym => ColumnType::SignedLong2
25
26
  }
26
27
  TYPE_CAST_CLASS.default = ColumnType::String
27
28
  TYPE_CAST_CLASS.freeze
@@ -79,8 +80,7 @@ module DBF
79
80
  private
80
81
 
81
82
  def clean(value) # :nodoc:
82
- truncated_value = value.strip.partition("\x00").first
83
- truncated_value.gsub(/[^\x20-\x7E]/, '')
83
+ value.strip.gsub("\x00", '').gsub(/[^\x20-\x7E]/, '')
84
84
  end
85
85
 
86
86
  def encode(value, strip_output = false) # :nodoc:
@@ -12,7 +12,6 @@ module DBF
12
12
  end
13
13
 
14
14
  class Nil < Base
15
-
16
15
  # @param _value [String]
17
16
  def type_cast(_value)
18
17
  nil
@@ -20,7 +19,6 @@ module DBF
20
19
  end
21
20
 
22
21
  class Number < Base
23
-
24
22
  # @param value [String]
25
23
  def type_cast(value)
26
24
  return nil if value.strip.empty?
@@ -30,7 +28,6 @@ module DBF
30
28
  end
31
29
 
32
30
  class Currency < Base
33
-
34
31
  # @param value [String]
35
32
  def type_cast(value)
36
33
  (value.unpack1('q<') / 10_000.0).to_f
@@ -38,15 +35,22 @@ module DBF
38
35
  end
39
36
 
40
37
  class SignedLong < Base
41
-
42
38
  # @param value [String]
43
39
  def type_cast(value)
44
40
  value.unpack1('l<')
45
41
  end
46
42
  end
47
43
 
48
- class Float < Base
44
+ class SignedLong2 < Base
45
+ # @param value [String]
46
+ def type_cast(value)
47
+ s = value.unpack1('B*')
48
+ sign_multiplier = s[0] == '0' ? -1 : 1
49
+ s[1, 31].to_i(2) * sign_multiplier
50
+ end
51
+ end
49
52
 
53
+ class Float < Base
50
54
  # @param value [String]
51
55
  def type_cast(value)
52
56
  value.to_f
@@ -54,7 +58,6 @@ module DBF
54
58
  end
55
59
 
56
60
  class Double < Base
57
-
58
61
  # @param value [String]
59
62
  def type_cast(value)
60
63
  value.unpack1('E')
@@ -62,7 +65,6 @@ module DBF
62
65
  end
63
66
 
64
67
  class Boolean < Base
65
-
66
68
  # @param value [String]
67
69
  def type_cast(value)
68
70
  value.strip.match?(/^(y|t)$/i)
@@ -70,7 +72,6 @@ module DBF
70
72
  end
71
73
 
72
74
  class Date < Base
73
-
74
75
  # @param value [String]
75
76
  def type_cast(value)
76
77
  value.match?(/\d{8}/) && ::Date.strptime(value, '%Y%m%d')
@@ -80,7 +81,6 @@ module DBF
80
81
  end
81
82
 
82
83
  class DateTime < Base
83
-
84
84
  # @param value [String]
85
85
  def type_cast(value)
86
86
  days, msecs = value.unpack('l2')
@@ -92,7 +92,6 @@ module DBF
92
92
  end
93
93
 
94
94
  class Memo < Base
95
-
96
95
  # @param value [String]
97
96
  def type_cast(value)
98
97
  if encoding && !value.nil?
@@ -104,7 +103,6 @@ module DBF
104
103
  end
105
104
 
106
105
  class General < Base
107
-
108
106
  # @param value [String]
109
107
  def type_cast(value)
110
108
  value
@@ -112,7 +110,6 @@ module DBF
112
110
  end
113
111
 
114
112
  class String < Base
115
-
116
113
  # @param value [String]
117
114
  def type_cast(value)
118
115
  value = value.strip