toji 2.18.0 → 2.19.0
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/example/example_core.rb +10 -10
- data/lib/toji/calendar.rb +2 -2
- data/lib/toji/calendar/date_row.rb +2 -2
- data/lib/toji/product/schedule_factory.rb +10 -8
- data/lib/toji/recipe.rb +4 -2
- data/lib/toji/recipe/step.rb +4 -0
- data/lib/toji/schedule/rice_schedule.rb +1 -1
- data/lib/toji/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88279093d88d3203f07d8279fe7efdafaa9d5e27842dafb1b9d5d49bf1e97256
|
4
|
+
data.tar.gz: 5c92d934a4ef3ab0f361307ae4453af27943cc19beb4ee4dde506cdce9c37d2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ca63ae60e1627d2b7ac8a78adab6170eaa32cf328911c8cf97593ac62dd2cc9d90b098bf1514b755bdc8a4dffdab3c9e21e0c8a669de0d5a77656561a00c1bf
|
7
|
+
data.tar.gz: dc0a67b638aa444a65cc45a414653e7344cc3082a32f10bdaafaabe007161b15a3987634c2886ccd7cd0f99e7c71b7c55a86ae3423724f6a0aca2147a12e6228
|
data/example/example_core.rb
CHANGED
@@ -24,26 +24,26 @@ module Example
|
|
24
24
|
@color = color
|
25
25
|
end
|
26
26
|
|
27
|
-
def create_koji_schedule(date:,
|
27
|
+
def create_koji_schedule(date:, step_weights:, kojis:)
|
28
28
|
expect = kojis.first.dup
|
29
29
|
expect.weight = kojis.map(&:weight).sum
|
30
30
|
|
31
31
|
KojiSchedule.new(
|
32
32
|
product: self,
|
33
33
|
date: date,
|
34
|
-
|
34
|
+
step_weights: step_weights,
|
35
35
|
expect: expect,
|
36
36
|
)
|
37
37
|
end
|
38
38
|
|
39
|
-
def create_kake_schedule(date:,
|
39
|
+
def create_kake_schedule(date:, step_weights:, kakes:)
|
40
40
|
expect = kakes.first.dup
|
41
41
|
expect.weight = kakes.map(&:weight).sum
|
42
42
|
|
43
43
|
KakeSchedule.new(
|
44
44
|
product: self,
|
45
45
|
date: date,
|
46
|
-
|
46
|
+
step_weights: step_weights,
|
47
47
|
expect: expect,
|
48
48
|
)
|
49
49
|
end
|
@@ -940,13 +940,13 @@ module Example
|
|
940
940
|
attr_reader :product
|
941
941
|
attr_reader :date
|
942
942
|
|
943
|
-
attr_reader :
|
943
|
+
attr_reader :step_weights
|
944
944
|
attr_reader :expect
|
945
945
|
|
946
|
-
def initialize(product:, date:,
|
946
|
+
def initialize(product:, date:, step_weights:, expect:)
|
947
947
|
@product = product
|
948
948
|
@date = date
|
949
|
-
@
|
949
|
+
@step_weights = step_weights
|
950
950
|
@expect = expect
|
951
951
|
end
|
952
952
|
end
|
@@ -957,13 +957,13 @@ module Example
|
|
957
957
|
attr_reader :product
|
958
958
|
attr_reader :date
|
959
959
|
|
960
|
-
attr_reader :
|
960
|
+
attr_reader :step_weights
|
961
961
|
attr_reader :expect
|
962
962
|
|
963
|
-
def initialize(product:, date:,
|
963
|
+
def initialize(product:, date:, step_weights:, expect:)
|
964
964
|
@product = product
|
965
965
|
@date = date
|
966
|
-
@
|
966
|
+
@step_weights = step_weights
|
967
967
|
@expect = expect
|
968
968
|
end
|
969
969
|
end
|
data/lib/toji/calendar.rb
CHANGED
@@ -32,8 +32,8 @@ module Toji
|
|
32
32
|
kake_schedules = @products.map{|product| product.kake_schedules}.flatten
|
33
33
|
schedules = koji_schedules + kake_schedules
|
34
34
|
|
35
|
-
koji_len = koji_schedules.map{|schedule| schedule.
|
36
|
-
kake_len = kake_schedules.map{|schedule| schedule.
|
35
|
+
koji_len = koji_schedules.map{|schedule| schedule.step_weights.first[:index]}.max + 1
|
36
|
+
kake_len = kake_schedules.map{|schedule| schedule.step_weights.first[:index]}.max + 1
|
37
37
|
min_date = schedules.map(&:date).min
|
38
38
|
max_date = schedules.map(&:date).max
|
39
39
|
|
@@ -14,11 +14,11 @@ module Toji
|
|
14
14
|
def <<(schedule)
|
15
15
|
case schedule.rice_type
|
16
16
|
when :koji
|
17
|
-
index = schedule.
|
17
|
+
index = schedule.step_weights.first[:index]
|
18
18
|
@kojis[index] ||= DateColumn.new
|
19
19
|
@kojis[index] << schedule
|
20
20
|
when :kake
|
21
|
-
index = schedule.
|
21
|
+
index = schedule.step_weights.first[:index]
|
22
22
|
@kakes[index] ||= DateColumn.new
|
23
23
|
@kakes[index] << schedule
|
24
24
|
end
|
@@ -2,11 +2,11 @@ module Toji
|
|
2
2
|
module Product
|
3
3
|
module ScheduleFactory
|
4
4
|
|
5
|
-
def create_koji_schedule(date:,
|
5
|
+
def create_koji_schedule(date:, step_weights:, kojis:)
|
6
6
|
raise Error, "implement required: create_koji_schedule"
|
7
7
|
end
|
8
8
|
|
9
|
-
def create_kake_schedule(date:,
|
9
|
+
def create_kake_schedule(date:, step_weights:, kakes:)
|
10
10
|
raise Error, "implement required: create_kake_schedule"
|
11
11
|
end
|
12
12
|
|
@@ -18,9 +18,10 @@ module Toji
|
|
18
18
|
recipe.steps.inject([]) {|result, step|
|
19
19
|
step.kojis&.each {|koji|
|
20
20
|
result << {
|
21
|
-
|
21
|
+
step_weight: {
|
22
22
|
index: step.index,
|
23
23
|
subindex: step.subindex,
|
24
|
+
weight: koji.weight,
|
24
25
|
},
|
25
26
|
date: base_date.next_day(koji.interval_days),
|
26
27
|
koji: koji,
|
@@ -34,7 +35,7 @@ module Toji
|
|
34
35
|
}.map {|(date, _group_key), schedules|
|
35
36
|
create_koji_schedule(
|
36
37
|
date: date,
|
37
|
-
|
38
|
+
step_weights: schedules.map {|schedule| schedule[:step_weight]}.sort_by {|x| [x[:index], x[:subindex]]},
|
38
39
|
kojis: schedules.map{|schedule| schedule[:koji]},
|
39
40
|
)
|
40
41
|
}
|
@@ -44,9 +45,10 @@ module Toji
|
|
44
45
|
recipe.steps.inject([]) {|result, step|
|
45
46
|
step.kakes&.each {|kake|
|
46
47
|
result << {
|
47
|
-
|
48
|
+
step_weight: {
|
48
49
|
index: step.index,
|
49
50
|
subindex: step.subindex,
|
51
|
+
weight: kake.weight,
|
50
52
|
},
|
51
53
|
date: base_date.next_day(kake.interval_days),
|
52
54
|
kake: kake,
|
@@ -56,11 +58,11 @@ module Toji
|
|
56
58
|
}.select {|schedule|
|
57
59
|
0<schedule[:kake]&.weight.to_f
|
58
60
|
}.group_by {|schedule|
|
59
|
-
[schedule[:date], schedule[:kake].group_key, schedule[:
|
60
|
-
}.map {|(date, _group_key,
|
61
|
+
[schedule[:date], schedule[:kake].group_key, schedule[:step_weight]]
|
62
|
+
}.map {|(date, _group_key, _step_weight), schedules|
|
61
63
|
create_kake_schedule(
|
62
64
|
date: date,
|
63
|
-
|
65
|
+
step_weights: schedules.map {|schedule| schedule[:step_weight]}.sort_by {|x| [x[:index], x[:subindex]]},
|
64
66
|
kakes: schedules.map{|schedule| schedule[:kake]},
|
65
67
|
)
|
66
68
|
}
|
data/lib/toji/recipe.rb
CHANGED
@@ -54,7 +54,7 @@ module Toji
|
|
54
54
|
# 酒母歩合の累計
|
55
55
|
def cumulative_moto_ratios
|
56
56
|
rice_total = steps.map(&:rice_total)
|
57
|
-
moto = rice_total.
|
57
|
+
moto = steps.select(&:moto?).map(&:rice_total).sum.to_f
|
58
58
|
|
59
59
|
rice_total.map.with_index {|x,i|
|
60
60
|
moto / rice_total[0..i].inject(&:+)
|
@@ -80,8 +80,10 @@ module Toji
|
|
80
80
|
#
|
81
81
|
# 出典: 酒造教本 P95
|
82
82
|
def rice_ratios
|
83
|
+
moto = steps.select(&:moto?).map(&:rice_total).sum.to_f
|
84
|
+
|
83
85
|
steps.map {|step|
|
84
|
-
step.rice_total /
|
86
|
+
step.rice_total / moto
|
85
87
|
}
|
86
88
|
end
|
87
89
|
|
data/lib/toji/recipe/step.rb
CHANGED
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.19.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:
|
11
|
+
date: 2021-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -209,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
209
|
- !ruby/object:Gem::Version
|
210
210
|
version: '0'
|
211
211
|
requirements: []
|
212
|
-
rubygems_version: 3.1
|
212
|
+
rubygems_version: 3.2.0.rc.1
|
213
213
|
signing_key:
|
214
214
|
specification_version: 4
|
215
215
|
summary: Management tools for brewing japanese sake.
|