dbf 1.7.4 → 1.7.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 1.7.5
2
+ - fixes FoxPro currency (Y) fields
3
+
1
4
  # 1.7.4
2
5
  - Replace Memo Type with Memo File boolean in command-line utility summary output
3
6
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dbf (1.7.3)
4
+ dbf (1.7.4)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -28,6 +28,7 @@ module DBF
28
28
  when 'N' then unpack_number(value)
29
29
  when 'I' then unpack_unsigned_long(value)
30
30
  when 'F' then value.to_f
31
+ when 'Y' then unpack_unsigned_long(value) / 10000.0
31
32
  when 'D' then decode_date(value)
32
33
  when 'T' then decode_datetime(value)
33
34
  when 'L' then boolean(value)
@@ -91,6 +92,8 @@ module DBF
91
92
  decimal > 0 ? ":float" : ":integer"
92
93
  when "I"
93
94
  ":integer"
95
+ when "Y"
96
+ ":decimal, :precision => 15, :scale => 4"
94
97
  when "D"
95
98
  ":date"
96
99
  when "T"
data/lib/dbf/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module DBF
2
- VERSION = '1.7.4'
2
+ VERSION = '1.7.5'
3
3
  end
@@ -137,6 +137,14 @@ describe DBF::Column::Dbase do
137
137
  end
138
138
  end
139
139
 
140
+ context 'with type Y (currency)' do
141
+ let(:column) { DBF::Column::Dbase.new "ColumnName", "Y", 8, 4, "31" }
142
+
143
+ it 'casts to float' do
144
+ column.type_cast(" \xBF\x02\x00\x00\x00\x00\x00").should == 18.0
145
+ end
146
+ end
147
+
140
148
  context "#schema_definition" do
141
149
  context 'with type N (number)' do
142
150
  it "outputs an integer column" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.4
4
+ version: 1.7.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-03-15 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70303763340460 !ruby/object:Gem::Requirement
16
+ requirement: &70239250987360 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.8.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70303763340460
24
+ version_requirements: *70239250987360
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70303763340000 !ruby/object:Gem::Requirement
27
+ requirement: &70239250986900 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.9.2
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70303763340000
35
+ version_requirements: *70239250986900
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rdoc
38
- requirement: &70303763339520 !ruby/object:Gem::Requirement
38
+ requirement: &70239250986420 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '3.11'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70303763339520
46
+ version_requirements: *70239250986420
47
47
  description: A small fast library for reading dBase, xBase, Clipper and FoxPro database
48
48
  files.
49
49
  email: keithm@infused.org