feidee_utils 0.0.5.2 → 0.0.5.3
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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/feidee_utils/account.rb +6 -6
- data/lib/feidee_utils/category.rb +2 -2
- data/lib/feidee_utils/record/accessors.rb +3 -3
- data/lib/feidee_utils/record.rb +16 -5
- data/lib/feidee_utils/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52939cfeaaed123fbd26ae21d28323de5e4f9315
|
4
|
+
data.tar.gz: e9fea8a9ebda721a02a0a71a49a4aed8b4382bad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 262d1e6c897f1ad951605df672c58d1f2058eb5d28554754100e8ee5e340606533a0e0dad838d01db0738b960df6b6912be520a60367a67e34a41ed1055c0331
|
7
|
+
data.tar.gz: 74daf0b8276450c6359668881731ba86f2339a882340098457e91c2dabcd251fc2c0cfd231057de214de03acc626adedb5588e831f163dd511587e5fa13bf85a
|
data/README.md
CHANGED
@@ -59,7 +59,7 @@ Sometimes we have to compare the content of two backups and must open them at
|
|
59
59
|
the same time. Only one database can be opened using ActiveRecord. It is not
|
60
60
|
designed to be used in such a way.
|
61
61
|
|
62
|
-
Why Feidee Utils
|
62
|
+
Why Feidee Utils at all
|
63
63
|
-----------
|
64
64
|
Originally the Feidee Android and iOS app let users export their personal data
|
65
65
|
recorded by the app. Since some version last year (2014), the export
|
data/lib/feidee_utils/account.rb
CHANGED
@@ -5,18 +5,18 @@ require 'bigdecimal'
|
|
5
5
|
module FeideeUtils
|
6
6
|
class Account < Record
|
7
7
|
def validate_integrity
|
8
|
-
unless not
|
9
|
-
raise "Account type should always be 0, but it's #{
|
8
|
+
unless not column("type") or column("type") == 0
|
9
|
+
raise "Account type should always be 0, but it's #{column("type")}.\n" +
|
10
10
|
inspect
|
11
11
|
end
|
12
|
-
unless
|
12
|
+
unless column("usedCount") == 0
|
13
13
|
raise "Account usedCount should always be 0," +
|
14
|
-
" but it's #{
|
14
|
+
" but it's #{column("usedCount")}.\n"+
|
15
15
|
inspect
|
16
16
|
end
|
17
|
-
unless
|
17
|
+
unless column("uuid").to_s.empty?
|
18
18
|
raise "Account uuid should always be empty,"+
|
19
|
-
" but it's #{
|
19
|
+
" but it's #{column("uuid")}.\n" +
|
20
20
|
inspect
|
21
21
|
end
|
22
22
|
unless flat_parent_hierachy?
|
@@ -10,9 +10,9 @@ module FeideeUtils
|
|
10
10
|
def validate_integrity
|
11
11
|
validate_depth_integrity
|
12
12
|
validate_one_level_path_integrity
|
13
|
-
unless
|
13
|
+
unless column("usedCount") == 0
|
14
14
|
raise "Category usedCount should always be 0, " +
|
15
|
-
"but it's #{
|
15
|
+
"but it's #{column("usedCount")}.\n" +
|
16
16
|
inspect
|
17
17
|
end
|
18
18
|
end
|
@@ -2,11 +2,11 @@ module FeideeUtils
|
|
2
2
|
class Record
|
3
3
|
module Accessors
|
4
4
|
def poid
|
5
|
-
|
5
|
+
column(self.class.id_field_name)
|
6
6
|
end
|
7
7
|
|
8
8
|
def last_update_time
|
9
|
-
timestamp_to_time(
|
9
|
+
timestamp_to_time(column("lastUpdateTime"))
|
10
10
|
end
|
11
11
|
|
12
12
|
module ClassMethods
|
@@ -15,7 +15,7 @@ module FeideeUtils
|
|
15
15
|
if method_defined? name
|
16
16
|
raise "Accessor #{name} already exists in #{self.name}."
|
17
17
|
end
|
18
|
-
define_method name do
|
18
|
+
define_method name do column(key) end
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
data/lib/feidee_utils/record.rb
CHANGED
@@ -23,12 +23,10 @@ module FeideeUtils
|
|
23
23
|
# is created in a new namepsace. For each subclass of Record, a new subclass
|
24
24
|
# is copied to the new namespace, with it's database method overloaded.
|
25
25
|
class Record
|
26
|
-
attr_reader :field, :field_type
|
27
|
-
|
28
26
|
public
|
29
|
-
def initialize(columns, types,
|
30
|
-
@
|
31
|
-
@
|
27
|
+
def initialize(columns, types, row)
|
28
|
+
@columns = columns.freeze
|
29
|
+
@row = row.freeze
|
32
30
|
|
33
31
|
validate_integrity
|
34
32
|
end
|
@@ -68,5 +66,18 @@ module FeideeUtils
|
|
68
66
|
extend Persistent::ClassMethods
|
69
67
|
# Helper methods to convert data types.
|
70
68
|
include Utils
|
69
|
+
|
70
|
+
protected
|
71
|
+
def column key
|
72
|
+
# Looking up index is not as slow as it appears. The size of the array is
|
73
|
+
# usually less than 20 and the strings are usually different in the first
|
74
|
+
# few characters. The overhead is relatively low.
|
75
|
+
# In fact, a downstream benchmark showed that it is faster than building a
|
76
|
+
# hash upfront and lookup the hash here.
|
77
|
+
index = @columns.index key
|
78
|
+
return nil if index.nil?
|
79
|
+
@row[index]
|
80
|
+
end
|
81
|
+
|
71
82
|
end
|
72
83
|
end
|
data/lib/feidee_utils/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feidee_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.5.
|
4
|
+
version: 0.0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Liqing Muyi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
159
|
version: '0'
|
160
160
|
requirements: []
|
161
161
|
rubyforge_project:
|
162
|
-
rubygems_version: 2.5.2
|
162
|
+
rubygems_version: 2.5.2.3
|
163
163
|
signing_key:
|
164
164
|
specification_version: 4
|
165
165
|
summary: Utils to extract useful information from Feidee Mymoney backup.
|