toji 2.25.0 → 2.26.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/example/recipe.rb +1 -1
- data/lib/toji/recipe.rb +126 -14
- data/lib/toji/recipe/step.rb +31 -12
- data/lib/toji/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: 6c5c928141c50b2cb53f8a876745dae8de74474ba19a5bb3ce66628372fb3915
|
4
|
+
data.tar.gz: 8e8f47734c17433cddcce0e22a841c768d8e3a8d4dc850362dc35608c5f2b2b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0c491de20e80b714d92a742ac56f6cb9bb7563272485a04c5f43caf715cb1a69af2d6cb3607209fef99f3aad162d0b5e8b543481c01889271a43b34da3693b8
|
7
|
+
data.tar.gz: b60dd30b4e146431b2b7a3bbffe16058ffac5f9cf0d886b76a62ba1c0fd9d9de10ea5b5357651e1bcedf5e01eadcc5b2161da03ba7fc053e3d51416b84048e66
|
data/example/recipe.rb
CHANGED
@@ -25,7 +25,7 @@ table = Terminal::Table.new do |t|
|
|
25
25
|
t << ["[累計]"]
|
26
26
|
t << ["総米(g)"] + recipe.cumulative_rice_totals
|
27
27
|
t << ["白米比率"] + recipe.rice_ratios.map{|v| v&.round(2)}
|
28
|
-
t << ["酒母歩合(%)"] + recipe.
|
28
|
+
t << ["酒母歩合(%)"] + recipe.moto_ratios.map{|s| s * 100}.map{|v| v&.round(2)}
|
29
29
|
t << ["タンク内容量(ml)"] + recipe.steps.map {|s|
|
30
30
|
s.yeasts.map(&:weight).sum + s.lactic_acids.map(&:weight).sum + s.kakes.map(&:steamed).sum + s.kojis.map(&:dekoji).sum + s.waters.map(&:weight).sum + s.alcohols.map(&:weight).sum
|
31
31
|
}.then {|a|
|
data/lib/toji/recipe.rb
CHANGED
@@ -52,23 +52,53 @@ module Toji
|
|
52
52
|
dst.round!(ndigit, mini_ndigit, half: half)
|
53
53
|
end
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
def compact!
|
56
|
+
steps.map(&:compact!)
|
57
|
+
steps.select! {|step| 0<step.ingredients.to_a.length}
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
ab_expects.select! {|ab| ab.alcohol && ab.nihonshudo}
|
60
|
+
ab_expects.uniq! {|ab| [ab.alcohol, ab.nihonshudo]}
|
61
|
+
|
62
|
+
self
|
62
63
|
end
|
63
64
|
|
64
|
-
|
65
|
-
|
66
|
-
rice_total = steps.map(&:rice_total)
|
67
|
-
moto = steps.select(&:moto?).map(&:rice_total).sum.to_f
|
65
|
+
def compact
|
66
|
+
Utils.check_dup(self)
|
68
67
|
|
69
|
-
|
70
|
-
|
71
|
-
|
68
|
+
dst = self.dup
|
69
|
+
dst.compact!
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
# 仕込み全体の集計値
|
74
|
+
|
75
|
+
# 総米
|
76
|
+
def rice_total
|
77
|
+
steps.map(&:rice_total).sum.to_f
|
78
|
+
end
|
79
|
+
|
80
|
+
# 麹歩合
|
81
|
+
# 原料白米に占める麹米の割合
|
82
|
+
# 留め仕込みまでの総米重量の20〜22%が標準である
|
83
|
+
# なお、留め仕込みまでの麹歩合が20%を下回ると蒸米の溶解糖化に影響が出るので注意がいる
|
84
|
+
# 出典: 酒造教本 P95
|
85
|
+
def koji_ratio
|
86
|
+
val = steps.map(&:koji_total).sum.to_f / rice_total
|
87
|
+
val.nan? ? 0.0 : val
|
88
|
+
end
|
89
|
+
|
90
|
+
# 汲水歩合
|
91
|
+
#
|
92
|
+
# 酒母: 110%が標準、高温糖化酒母は150〜180%
|
93
|
+
# 添: 85〜100%の範囲で90%が標準、湧き進め型は歩合が高い
|
94
|
+
# 仲: 120%が標準
|
95
|
+
# 留: 130〜150%の範囲
|
96
|
+
# 全体: 留までの総米に対し120〜130%、標準は125%、高級酒は130〜145%である
|
97
|
+
#
|
98
|
+
# 出典: 酒造教本 P96
|
99
|
+
def water_ratio
|
100
|
+
val = steps.map(&:water_total).sum.to_f / rice_total
|
101
|
+
val.nan? ? 0.0 : val
|
72
102
|
end
|
73
103
|
|
74
104
|
# 酒母歩合
|
@@ -78,9 +108,70 @@ module Toji
|
|
78
108
|
#
|
79
109
|
# 出典: 酒造教本 P96
|
80
110
|
def moto_ratio
|
81
|
-
|
111
|
+
moto_ratios.last || 0.0
|
112
|
+
end
|
113
|
+
|
114
|
+
# 麹米精米歩合
|
115
|
+
def koji_polishing_ratio
|
116
|
+
kojis = steps.flat_map{|step| step.kojis}.select{|koji| 0<koji.weight}
|
117
|
+
if kojis.length==0 || kojis.find{|koji| !koji.polishing_ratio}
|
118
|
+
Float::NAN
|
119
|
+
else
|
120
|
+
ratio_sum = kojis.map{|koji| koji.polishing_ratio * koji.weight}.sum.to_f
|
121
|
+
ratio_sum / steps.map(&:koji_total).sum.to_f
|
122
|
+
end
|
82
123
|
end
|
83
124
|
|
125
|
+
# 掛米精米歩合
|
126
|
+
def kake_polishing_ratio
|
127
|
+
kakes = steps.flat_map{|step| step.kakes}.select{|kake| 0<kake.weight}
|
128
|
+
if kakes.length==0 || kakes.find{|kake| !kake.polishing_ratio}
|
129
|
+
Float::NAN
|
130
|
+
else
|
131
|
+
ratio_sum = kakes.map{|kake| kake.polishing_ratio * kake.weight}.sum.to_f
|
132
|
+
ratio_sum / steps.map(&:kake_total).sum.to_f
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
|
137
|
+
# 累計
|
138
|
+
|
139
|
+
def cumulate(key)
|
140
|
+
values = steps.map(&key)
|
141
|
+
|
142
|
+
values.map.with_index {|x,i|
|
143
|
+
values[0..i].sum
|
144
|
+
}
|
145
|
+
end
|
146
|
+
|
147
|
+
# 総米の累計
|
148
|
+
def cumulative_rice_totals
|
149
|
+
cumulate(:rice_total)
|
150
|
+
end
|
151
|
+
|
152
|
+
# 麹歩合の累計
|
153
|
+
def cumulative_koji_ratios
|
154
|
+
rice_totals = cumulate(:rice_total)
|
155
|
+
koji_totals = cumulate(:koji_total)
|
156
|
+
|
157
|
+
rice_totals.map.with_index {|rice_total,i|
|
158
|
+
koji_totals[i] / rice_total
|
159
|
+
}
|
160
|
+
end
|
161
|
+
|
162
|
+
# 汲水歩合の累計
|
163
|
+
def cumulative_water_ratios
|
164
|
+
rice_totals = cumulate(:rice_total)
|
165
|
+
water_totals = cumulate(:water_total)
|
166
|
+
|
167
|
+
rice_totals.map.with_index {|rice_total,i|
|
168
|
+
water_totals[i] / rice_total
|
169
|
+
}
|
170
|
+
end
|
171
|
+
|
172
|
+
|
173
|
+
# 比率
|
174
|
+
|
84
175
|
# 白米比率
|
85
176
|
#
|
86
177
|
# 発酵型と白米比率
|
@@ -97,6 +188,27 @@ module Toji
|
|
97
188
|
}
|
98
189
|
end
|
99
190
|
|
191
|
+
# 総米の割合
|
192
|
+
def rice_total_percentages
|
193
|
+
rice_totals = steps.map(&:rice_total)
|
194
|
+
total = rice_totals.sum
|
195
|
+
|
196
|
+
rice_totals.map {|rice_total|
|
197
|
+
rice_total / total
|
198
|
+
}
|
199
|
+
end
|
200
|
+
|
201
|
+
# 酒母歩合の累計
|
202
|
+
def moto_ratios
|
203
|
+
rice_total = steps.map(&:rice_total)
|
204
|
+
moto = steps.select(&:moto?).map(&:rice_total).sum.to_f
|
205
|
+
|
206
|
+
rice_total.map.with_index {|x,i|
|
207
|
+
moto / rice_total[0..i].inject(&:+)
|
208
|
+
}
|
209
|
+
end
|
210
|
+
|
211
|
+
|
100
212
|
def table_data
|
101
213
|
headers = [""] + steps.map.with_index{|s,i| :"Step#{i}"} + [:total]
|
102
214
|
keys = [["RiceTotal", :rice_total], ["Kake", :kakes], ["Koji", :kojis], ["Alcohol", :alcohols], ["Water", :waters], ["LacticAcid", :lactic_acids]]
|
data/lib/toji/recipe/step.rb
CHANGED
@@ -41,25 +41,23 @@ module Toji
|
|
41
41
|
(waters || []).map(&:weight).map(&:to_f).sum.to_f
|
42
42
|
end
|
43
43
|
|
44
|
+
# 乳酸
|
45
|
+
def lactic_acid_total
|
46
|
+
(lactic_acids || []).map(&:weight).map(&:to_f).sum.to_f
|
47
|
+
end
|
48
|
+
|
49
|
+
# 醸造アルコール
|
50
|
+
def alcohol_total
|
51
|
+
(alcohols || []).map(&:weight).map(&:to_f).sum.to_f
|
52
|
+
end
|
53
|
+
|
44
54
|
# 麹歩合
|
45
|
-
# 原料白米に占める麹米の割合
|
46
|
-
# 留め仕込みまでの総米重量の20〜22%が標準である
|
47
|
-
# なお、留め仕込みまでの麹歩合が20%を下回ると蒸米の溶解糖化に影響が出るので注意がいる
|
48
|
-
# 出典: 酒造教本 P95
|
49
55
|
def koji_ratio
|
50
56
|
val = koji_total / rice_total
|
51
57
|
val.nan? ? 0.0 : val
|
52
58
|
end
|
53
59
|
|
54
60
|
# 汲水歩合
|
55
|
-
#
|
56
|
-
# 酒母: 110%が標準、高温糖化酒母は150〜180%
|
57
|
-
# 添: 85〜100%の範囲で90%が標準、湧き進め型は歩合が高い
|
58
|
-
# 仲: 120%が標準
|
59
|
-
# 留: 130〜150%の範囲
|
60
|
-
# 全体: 留までの総米に対し120〜130%、標準は125%、高級酒は130〜145%である
|
61
|
-
#
|
62
|
-
# 出典: 酒造教本 P96
|
63
61
|
def water_ratio
|
64
62
|
val = water_total / rice_total
|
65
63
|
val.nan? ? 0.0 : val
|
@@ -136,6 +134,27 @@ module Toji
|
|
136
134
|
dst.round!(ndigit, mini_ndigit, half: half)
|
137
135
|
end
|
138
136
|
|
137
|
+
def compact!
|
138
|
+
kojis.select! {|koji| 0<koji.weight.to_f}
|
139
|
+
kojis.each {|koji|
|
140
|
+
koji.tanekojis.select! {|tanekoji| 0<tanekoji.ratio.to_f}
|
141
|
+
}
|
142
|
+
kakes.select! {|kake| 0<kake.weight.to_f}
|
143
|
+
waters.select! {|water| 0<water.weight.to_f}
|
144
|
+
lactic_acids.select! {|lactic_acid| 0<lactic_acid.weight.to_f}
|
145
|
+
alcohols.select! {|alcohol| 0<alcohol.weight.to_f}
|
146
|
+
yeasts.select! {|yeast| 0<yeast.weight.to_f}
|
147
|
+
|
148
|
+
self
|
149
|
+
end
|
150
|
+
|
151
|
+
def compact
|
152
|
+
Utils.check_dup(self)
|
153
|
+
|
154
|
+
dst = self.dup
|
155
|
+
dst.compact!
|
156
|
+
end
|
157
|
+
|
139
158
|
def +(other)
|
140
159
|
if Step===other
|
141
160
|
Utils.check_dup(self)
|
data/lib/toji/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toji
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.26.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoshida Tetsuya
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|