lucarecord 0.2.19 → 0.2.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/luca_record/dict.rb +2 -0
- data/lib/luca_record/io.rb +25 -0
- data/lib/luca_record/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2644c50f67e64dfe2502400e04eddb6278a314d00f82eb5a51a6489797f0b48
|
4
|
+
data.tar.gz: c6d286442884c6675f18340ad2eb3322cd76515992530cbf4fc8536b66a6bbad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0122e43160066ce33dad8478fc99cd4bc639abf232788852ebce74328f664f413756ea91c73a6f6372f4dce9648a9c6776dd7f7ee1f0971930b71f0816a2841b
|
7
|
+
data.tar.gz: '09c51366863747bfea0cdf829d0829be6d084b79cbc729c3cb51ecea7f07196ca2c7ff0eea8b52d834d0af476de9cb953ef50d9e1b7e620de0c6f5d51c64f158'
|
data/CHANGELOG.md
CHANGED
data/lib/luca_record/dict.rb
CHANGED
@@ -71,6 +71,8 @@ module LucaRecord
|
|
71
71
|
config[:year] = @config['year'] if @config.dig('year')
|
72
72
|
config[:month] = @config['month'] if @config.dig('month')
|
73
73
|
config[:day] = @config['day'] if @config.dig('day')
|
74
|
+
config[:default_debit] = @config['default_debit'] if @config.dig('default_debit')
|
75
|
+
config[:default_credit] = @config['default_credit'] if @config.dig('default_credit')
|
74
76
|
end
|
75
77
|
end
|
76
78
|
|
data/lib/luca_record/io.rb
CHANGED
@@ -119,6 +119,31 @@ module LucaRecord # :nodoc:
|
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
|
+
# If multiple ID matched, return short ID and human readable label.
|
123
|
+
#
|
124
|
+
def id_completion(phrase, label: 'name', basedir: @dirname)
|
125
|
+
list = prefix_search(phrase, basedir: basedir)
|
126
|
+
case list.length
|
127
|
+
when 1
|
128
|
+
list
|
129
|
+
when 0
|
130
|
+
raise 'No match on specified phrase'
|
131
|
+
else
|
132
|
+
(3..list[0].length).each do |l|
|
133
|
+
if list.map { |id| id[0, l] }.uniq.length == list.length
|
134
|
+
return list.map { |id| { id: id[0, l], label: find(id).dig(label) } }
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
def prefix_search(phrase, basedir: @dirname)
|
141
|
+
glob_str = phrase.length <= 3 ? "#{phrase}*/*" : "#{id2path(phrase)}*"
|
142
|
+
Dir.chdir(abs_path(basedir)) do
|
143
|
+
Dir.glob(glob_str).to_a.map! { |path| path.gsub!('/', '') }
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
122
147
|
def prepare_dir!(basedir, date_obj)
|
123
148
|
dir_name = (Pathname(basedir) + LucaSupport::Code.encode_dirname(date_obj)).to_s
|
124
149
|
FileUtils.mkdir_p(dir_name) unless Dir.exist?(dir_name)
|
data/lib/luca_record/version.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.20
|
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-
|
11
|
+
date: 2020-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mail
|