quicken 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/quicken.rb +1 -0
- data/lib/quicken/parser.rb +10 -1
- data/quicken.gemspec +2 -2
- data/spec/quicken/parser_spec.rb +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/lib/quicken.rb
CHANGED
data/lib/quicken/parser.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
require "iconv"
|
2
|
+
require "kconv"
|
3
|
+
|
1
4
|
module Quicken
|
2
5
|
|
3
6
|
class Parser
|
@@ -14,6 +17,8 @@ module Quicken
|
|
14
17
|
section = nil
|
15
18
|
|
16
19
|
File.foreach(@file) do |line|
|
20
|
+
line = convert_to_utf8(line)
|
21
|
+
|
17
22
|
if line =~ /^\!(\S+)/
|
18
23
|
section = extract_section($1)
|
19
24
|
next
|
@@ -30,7 +35,7 @@ module Quicken
|
|
30
35
|
|
31
36
|
def build_objects
|
32
37
|
@account = Quicken::Account.new(@account_attrs) unless @account_attrs.empty?
|
33
|
-
@transactions = @transactions_attrs.collect do |t|
|
38
|
+
@transactions = @transactions_attrs.collect do |t|
|
34
39
|
t.merge!({:date_format=>@date_format}) unless @date_format.nil?
|
35
40
|
Quicken::Transaction.new(t)
|
36
41
|
end
|
@@ -60,6 +65,10 @@ module Quicken
|
|
60
65
|
section.gsub("Type:","").downcase.to_sym
|
61
66
|
end
|
62
67
|
|
68
|
+
def convert_to_utf8(string)
|
69
|
+
return string if Kconv.isutf8(string)
|
70
|
+
Iconv.conv('UTF-8', 'LATIN1//IGNORE', string)
|
71
|
+
end
|
63
72
|
end
|
64
73
|
|
65
74
|
end
|
data/quicken.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{quicken}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Daniel Lopes"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-06-02}
|
13
13
|
s.description = %q{QIF (Quicken Interchange Format) parser}
|
14
14
|
s.email = %q{danielvlopes@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/quicken/parser_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe Quicken::Parser do
|
|
5
5
|
qif = Quicken::Parser.new('spec/fixtures/default.qif').parse!
|
6
6
|
end
|
7
7
|
|
8
|
-
|
8
|
+
describe "when in account section" do
|
9
9
|
it "should return the account" do
|
10
10
|
file.account.should == Quicken::Account.new({:number=>"0833_5710633", :type=>"Bank"})
|
11
11
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Daniel Lopes
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-06-02 00:00:00 -03:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|