lucarecord 0.2.14 → 0.2.15
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/lib/luca_record.rb +3 -0
- data/lib/luca_record/dict.rb +2 -2
- data/lib/luca_record/io.rb +25 -14
- data/lib/luca_record/version.rb +1 -1
- data/lib/luca_support/code.rb +4 -3
- data/lib/luca_support/config.rb +1 -1
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d7ac838f340b86b71208f40357ebbe7c4217b1ed6b69dcf012b773d8fa0a532
|
4
|
+
data.tar.gz: c0e706fe9e1eef4abbb5d9600a5100931cd9384d45459481142fb3c594dbfd32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56f2f5575afb0a5e204a94ed66fa7b6ded3831316e9d71be17a02270f464b57551701c3938a447f479a4512255800d49bdc545e8f970f8d81f00c1be8caf5316
|
7
|
+
data.tar.gz: be5bf831649fb6d6ad74ca44ae18c9cbb4eabf26193926979776fb99f843c687a8dead90917dafeaa3e9289c2ec8eb83e78a2082fad50305df1f4b8bcaab96a9
|
data/lib/luca_record.rb
CHANGED
data/lib/luca_record/dict.rb
CHANGED
data/lib/luca_record/io.rb
CHANGED
@@ -20,12 +20,12 @@ module LucaRecord # :nodoc:
|
|
20
20
|
end
|
21
21
|
|
22
22
|
module ClassMethods
|
23
|
-
|
23
|
+
# ----------------------------------------------------------------
|
24
24
|
# :section: Query Methods
|
25
25
|
# Provide sematic search interfaces.
|
26
26
|
# <tt>basedir</tt> is set by class instance variable <tt>@dirname</tt>
|
27
27
|
# of each concrete class.
|
28
|
-
|
28
|
+
# ----------------------------------------------------------------
|
29
29
|
|
30
30
|
# find ID based record. Support uuid and encoded date.
|
31
31
|
def find(id, basedir = @dirname)
|
@@ -78,16 +78,16 @@ module LucaRecord # :nodoc:
|
|
78
78
|
def all(basedir = @dirname)
|
79
79
|
return enum_for(:all, basedir) unless block_given?
|
80
80
|
|
81
|
-
open_all(basedir) do |f|
|
81
|
+
open_all(basedir) do |f|
|
82
82
|
yield load_data(f)
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
-
|
86
|
+
# ----------------------------------------------------------------
|
87
87
|
# :section: Write Methods
|
88
88
|
# <tt>basedir</tt> is set by class instance variable <tt>@dirname</tt>
|
89
89
|
# of each concrete class.
|
90
|
-
|
90
|
+
# ----------------------------------------------------------------
|
91
91
|
|
92
92
|
# create hash based record
|
93
93
|
def create(obj, basedir = @dirname)
|
@@ -114,29 +114,40 @@ module LucaRecord # :nodoc:
|
|
114
114
|
|
115
115
|
def add_status!(id, status, basedir = @dirname)
|
116
116
|
path = abs_path(basedir) / id2path(id)
|
117
|
-
origin = YAML.load_file(path, {})
|
117
|
+
origin = YAML.load_file(path, **{})
|
118
118
|
newline = { status => DateTime.now.to_s }
|
119
119
|
origin['status'] = [] if origin['status'].nil?
|
120
120
|
origin['status'] << newline
|
121
121
|
File.write(path, YAML.dump(origin.sort.to_h))
|
122
122
|
end
|
123
123
|
|
124
|
-
|
124
|
+
# ----------------------------------------------------------------
|
125
125
|
# :section: Path Utilities
|
126
|
-
|
126
|
+
# ----------------------------------------------------------------
|
127
127
|
|
128
|
-
#
|
128
|
+
# Convert ID to file directory/filename path.
|
129
|
+
# 1st element of Array is used as directory, the others as filename.
|
130
|
+
# String without '/' is converted as git-like structure.
|
131
|
+
# Normal argument is as follows:
|
129
132
|
#
|
130
|
-
# [2020H, V001]
|
131
|
-
#
|
132
|
-
#
|
133
|
+
# ['2020H', 'V001', 'a7b806d04a044c6dbc4ce72932867719']
|
134
|
+
# => '2020H/V001-a7b806d04a044c6dbc4ce72932867719'
|
135
|
+
# 'a7b806d04a044c6dbc4ce72932867719'
|
136
|
+
# => 'a7b/806d04a044c6dbc4ce72932867719'
|
137
|
+
# '2020H/V001'
|
138
|
+
# => '2020H/V001'
|
133
139
|
def id2path(id)
|
134
140
|
if id.is_a?(Array)
|
135
|
-
id.
|
141
|
+
case id.length
|
142
|
+
when 0..2
|
143
|
+
id.join('/')
|
144
|
+
else
|
145
|
+
[id[0], id[1..-1].join('-')].join('/')
|
146
|
+
end
|
136
147
|
elsif id.include?('/')
|
137
148
|
id
|
138
149
|
else
|
139
|
-
encode_hashed_path(id)
|
150
|
+
encode_hashed_path(id).join('/')
|
140
151
|
end
|
141
152
|
end
|
142
153
|
|
data/lib/luca_record/version.rb
CHANGED
data/lib/luca_support/code.rb
CHANGED
@@ -12,7 +12,7 @@ module LucaSupport
|
|
12
12
|
def encode_txid(num)
|
13
13
|
txmap = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
14
14
|
l = txmap.length
|
15
|
-
txmap[num / (l**2)] + txmap[(num%(l**2)) / l] + txmap[num % l]
|
15
|
+
txmap[num / (l**2)] + txmap[(num % (l**2)) / l] + txmap[num % l]
|
16
16
|
end
|
17
17
|
|
18
18
|
def decode_txid(id)
|
@@ -73,7 +73,8 @@ module LucaSupport
|
|
73
73
|
end
|
74
74
|
|
75
75
|
#
|
76
|
-
# convert effective/defunct data into current hash on @date
|
76
|
+
# convert effective/defunct data into current hash on @date.
|
77
|
+
# not parse nested children.
|
77
78
|
#
|
78
79
|
def parse_current(dat)
|
79
80
|
{}.tap do |processed|
|
@@ -92,7 +93,7 @@ module LucaSupport
|
|
92
93
|
# - effective: 2020-1-1
|
93
94
|
# rank: 5
|
94
95
|
# point: 1000
|
95
|
-
# => { 'effective' => 2020-1-1, 'rank' => 5, '
|
96
|
+
# => { 'effective' => 2020-1-1, 'rank' => 5, 'point' => 1000 }
|
96
97
|
#
|
97
98
|
def take_current(dat, item)
|
98
99
|
target = dat.dig(item)
|
data/lib/luca_support/config.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lucarecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chuma Takahiro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mail
|
@@ -28,44 +28,44 @@ dependencies:
|
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.17'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.17'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '5.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '5.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 12.3.3
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 12.3.3
|
69
69
|
description: 'ERP File operation framework
|
70
70
|
|
71
71
|
'
|