toji 2.1.0 → 2.4.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/calendar.ipynb +281 -21
- data/example/calendar_file.ipynb +37 -37
- data/example/example_core.rb +27 -53
- data/example/{kake_recipe.rb → kake_ingredient.rb} +0 -1
- data/example/{koji_recipe.rb → koji_ingredient.rb} +1 -2
- data/example/koji_making.ipynb +9 -9
- data/example/koji_making.yaml +1 -0
- data/example/koji_making_multi.ipynb +22 -57
- data/example/moromi.ipynb +17 -17
- data/example/moromi.rb +1 -1
- data/example/recipe.rb +17 -10
- data/example/shubo.ipynb +12 -12
- data/example/shubo.yaml +2 -1
- data/lib/toji/brew.rb +4 -2
- data/lib/toji/brew/base.rb +6 -26
- data/lib/toji/brew/builder.rb +49 -21
- data/lib/toji/brew/graph/bmd.rb +1 -1
- data/lib/toji/brew/graph/multi_progress.rb +0 -121
- data/lib/toji/brew/graph/progress.rb +16 -51
- data/lib/toji/brew/koji.rb +2 -1
- data/lib/toji/brew/moromi.rb +2 -1
- data/lib/toji/brew/shubo.rb +2 -1
- data/lib/toji/brew/state.rb +6 -2
- data/lib/toji/brew/{state_wrapper.rb → wrapped_state.rb} +6 -32
- data/lib/toji/calendar.rb +1 -1
- data/lib/toji/ingredient/kake.rb +2 -2
- data/lib/toji/ingredient/kake/actual.rb +6 -7
- data/lib/toji/ingredient/kake/base.rb +1 -1
- data/lib/toji/ingredient/kake/expected.rb +0 -1
- data/lib/toji/ingredient/koji.rb +2 -2
- data/lib/toji/ingredient/koji/actual.rb +8 -9
- data/lib/toji/ingredient/koji/base.rb +1 -1
- data/lib/toji/ingredient/koji/expected.rb +0 -1
- data/lib/toji/ingredient/rice/actual_steamable.rb +4 -4
- data/lib/toji/ingredient/rice/base.rb +0 -1
- data/lib/toji/ingredient/rice/expected_steamable.rb +1 -3
- data/lib/toji/ingredient/rice_rate.rb +2 -14
- data/lib/toji/product/event.rb +0 -10
- data/lib/toji/recipe.rb +2 -11
- data/lib/toji/recipe/step.rb +33 -33
- data/lib/toji/version.rb +1 -1
- metadata +5 -5
@@ -75,7 +75,7 @@ module Toji
|
|
75
75
|
result << {x: xs, y: ys, text: text, name: "#{name}#{key}", line: {dash: @dash, shape: line_shape}, marker: {color: PLOT_COLORS[key]}}
|
76
76
|
}
|
77
77
|
|
78
|
-
if 0<@brew.
|
78
|
+
if 0<@brew.wrapped_states.length && 0<@brew.day_offset
|
79
79
|
result = result.map{|h|
|
80
80
|
h[:x].unshift(0)
|
81
81
|
h[:y].unshift(nil)
|
@@ -84,8 +84,8 @@ module Toji
|
|
84
84
|
}
|
85
85
|
end
|
86
86
|
|
87
|
-
#if 0<@brew.
|
88
|
-
# t = @brew.
|
87
|
+
#if 0<@brew.wrapped_states.length && @brew.wrapped_states.last.time.strftime("%T")!="00:00:00"
|
88
|
+
# t = @brew.wrapped_states.last.elapsed_time_with_offset
|
89
89
|
# t -= (t % DAY) - DAY
|
90
90
|
#
|
91
91
|
# result = result.map{|h|
|
@@ -117,28 +117,7 @@ module Toji
|
|
117
117
|
}
|
118
118
|
end
|
119
119
|
|
120
|
-
def
|
121
|
-
group = {}
|
122
|
-
prev = nil
|
123
|
-
|
124
|
-
@brew.each {|state|
|
125
|
-
val = state.send(group_by) || prev
|
126
|
-
prev = val
|
127
|
-
|
128
|
-
group[val] ||= []
|
129
|
-
group[val] << state
|
130
|
-
}
|
131
|
-
|
132
|
-
group
|
133
|
-
end
|
134
|
-
|
135
|
-
def state_group_count(group_by)
|
136
|
-
state_group_by(group_by).map{|val,states|
|
137
|
-
[val, states.length]
|
138
|
-
}.to_h
|
139
|
-
end
|
140
|
-
|
141
|
-
def table_data(keys=nil, group_by=nil, group_count=nil)
|
120
|
+
def table_data(keys=nil)
|
142
121
|
if !keys
|
143
122
|
keys = @brew.has_keys
|
144
123
|
keys.delete(:elapsed_time)
|
@@ -151,33 +130,19 @@ module Toji
|
|
151
130
|
keys &= @brew.has_keys
|
152
131
|
end
|
153
132
|
|
154
|
-
if group_by && group_count
|
155
|
-
brew_hash = state_group_by(group_by)
|
156
|
-
else
|
157
|
-
group_count = state_group_count(:itself)
|
158
|
-
brew_hash = state_group_by(:itself)
|
159
|
-
end
|
160
|
-
|
161
133
|
rows = []
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
v
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
v.round(3)
|
175
|
-
elsif v
|
176
|
-
v
|
177
|
-
else
|
178
|
-
""
|
179
|
-
end
|
180
|
-
}
|
134
|
+
@brew.each {|state|
|
135
|
+
rows << keys.map {|k|
|
136
|
+
v = state&.send(k)
|
137
|
+
if Array===v
|
138
|
+
v.map(&:to_s).join(", ")
|
139
|
+
elsif Float===v
|
140
|
+
v.round(3).to_s
|
141
|
+
elsif v
|
142
|
+
v.to_s
|
143
|
+
else
|
144
|
+
""
|
145
|
+
end
|
181
146
|
}
|
182
147
|
}
|
183
148
|
|
data/lib/toji/brew/koji.rb
CHANGED
data/lib/toji/brew/moromi.rb
CHANGED
data/lib/toji/brew/shubo.rb
CHANGED
data/lib/toji/brew/state.rb
CHANGED
@@ -54,6 +54,10 @@ module Toji
|
|
54
54
|
super(val&.to_time)
|
55
55
|
end
|
56
56
|
|
57
|
+
def warmings
|
58
|
+
super || []
|
59
|
+
end
|
60
|
+
|
57
61
|
def warmings=(val)
|
58
62
|
super([val].flatten.compact)
|
59
63
|
end
|
@@ -66,7 +70,7 @@ module Toji
|
|
66
70
|
end
|
67
71
|
end
|
68
72
|
|
69
|
-
def
|
73
|
+
def nihonshudo=(val)
|
70
74
|
if val
|
71
75
|
self.baume = val.to_f / -10.0
|
72
76
|
else
|
@@ -94,7 +98,7 @@ module Toji
|
|
94
98
|
def self.create(val)
|
95
99
|
if State===val
|
96
100
|
val
|
97
|
-
elsif
|
101
|
+
elsif WrappedState==val
|
98
102
|
val.state
|
99
103
|
#elsif Hash===val
|
100
104
|
# #s = Class.new {
|
@@ -2,7 +2,7 @@ require 'forwardable'
|
|
2
2
|
|
3
3
|
module Toji
|
4
4
|
module Brew
|
5
|
-
class
|
5
|
+
class WrappedState
|
6
6
|
extend Forwardable
|
7
7
|
|
8
8
|
attr_accessor :elapsed_time
|
@@ -21,8 +21,9 @@ module Toji
|
|
21
21
|
def_delegators :@state, :warmings
|
22
22
|
def_delegators :@state, :note
|
23
23
|
|
24
|
-
def initialize(
|
25
|
-
@elapsed_time = elapsed_time
|
24
|
+
def initialize(state, brew)
|
25
|
+
@elapsed_time = state.elapsed_time
|
26
|
+
@time = state.time
|
26
27
|
@state = state
|
27
28
|
@brew = brew
|
28
29
|
end
|
@@ -69,8 +70,8 @@ module Toji
|
|
69
70
|
def display_time(format="%m/%d %H:%M")
|
70
71
|
if @time
|
71
72
|
@time.strftime(format)
|
72
|
-
elsif @brew.
|
73
|
-
time = @brew.
|
73
|
+
elsif @brew.base_time
|
74
|
+
time = @brew.base_time + @elapsed_time
|
74
75
|
time.strftime(format)
|
75
76
|
else
|
76
77
|
utc_offset = Time.at(0).utc_offset
|
@@ -103,33 +104,6 @@ module Toji
|
|
103
104
|
target_alc - (_baume - target_nihonshudo * -0.1) * coef
|
104
105
|
end
|
105
106
|
end
|
106
|
-
|
107
|
-
def to_h
|
108
|
-
{
|
109
|
-
elapsed_time: elapsed_time,
|
110
|
-
time: time,
|
111
|
-
mark: mark,
|
112
|
-
temps: temps,
|
113
|
-
preset_temp: preset_temp,
|
114
|
-
room_temp: room_temp,
|
115
|
-
room_psychrometry: room_psychrometry,
|
116
|
-
acid: acid,
|
117
|
-
amino_acid: amino_acid,
|
118
|
-
alcohol: alcohol,
|
119
|
-
warmings: warmings,
|
120
|
-
note: note,
|
121
|
-
|
122
|
-
day: day,
|
123
|
-
day_label: day_label,
|
124
|
-
elapsed_time_with_offset: elapsed_time_with_offset,
|
125
|
-
baume: baume,
|
126
|
-
nihonshudo: nihonshudo,
|
127
|
-
display_baume: display_baume,
|
128
|
-
display_time: display_time,
|
129
|
-
moromi_day: moromi_day,
|
130
|
-
bmd: bmd,
|
131
|
-
}
|
132
|
-
end
|
133
107
|
end
|
134
108
|
end
|
135
109
|
end
|
data/lib/toji/calendar.rb
CHANGED
data/lib/toji/ingredient/kake.rb
CHANGED
@@ -9,8 +9,8 @@ module Toji
|
|
9
9
|
Expected.new(raw, rice_rate: rice_rate)
|
10
10
|
end
|
11
11
|
|
12
|
-
def self.actual(raw, soaked,
|
13
|
-
Actual.new(raw, soaked,
|
12
|
+
def self.actual(raw, soaked, steamed, cooled)
|
13
|
+
Actual.new(raw, soaked, steamed, cooled)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -5,17 +5,16 @@ module Toji
|
|
5
5
|
include Base
|
6
6
|
include Rice::ActualSteamable
|
7
7
|
|
8
|
-
def initialize(raw, soaked,
|
9
|
-
@raw = raw
|
10
|
-
@soaked = soaked
|
11
|
-
@
|
12
|
-
@
|
13
|
-
@cooled = cooled
|
8
|
+
def initialize(raw, soaked, steamed, cooled)
|
9
|
+
@raw = raw.to_f
|
10
|
+
@soaked = soaked.to_f
|
11
|
+
@steamed = steamed.to_f
|
12
|
+
@cooled = cooled.to_f
|
14
13
|
end
|
15
14
|
|
16
15
|
def *(other)
|
17
16
|
if Integer===other || Float===other
|
18
|
-
Actual.new(raw * other, soaked * other,
|
17
|
+
Actual.new(raw * other, soaked * other, steamed * other, cooled * other)
|
19
18
|
else
|
20
19
|
x, y = other.coerce(self)
|
21
20
|
x * y
|
@@ -6,7 +6,7 @@ module Toji
|
|
6
6
|
|
7
7
|
def +(other)
|
8
8
|
if Base===other
|
9
|
-
Actual.new(raw + other.raw, soaked + other.soaked,
|
9
|
+
Actual.new(raw + other.raw, soaked + other.soaked, steamed + other.steamed, cooled + other.cooled)
|
10
10
|
else
|
11
11
|
x, y = other.coerce(self)
|
12
12
|
x + y
|
data/lib/toji/ingredient/koji.rb
CHANGED
@@ -11,8 +11,8 @@ module Toji
|
|
11
11
|
Expected.new(raw, rice_rate: rice_rate, koji_rate: koji_rate)
|
12
12
|
end
|
13
13
|
|
14
|
-
def self.actual(raw, soaked,
|
15
|
-
Actual.new(raw, soaked,
|
14
|
+
def self.actual(raw, soaked, steamed, cooled, tanekoji, dekoji)
|
15
|
+
Actual.new(raw, soaked, steamed, cooled, tanekoji, dekoji)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -6,19 +6,18 @@ module Toji
|
|
6
6
|
include Rice::ActualSteamable
|
7
7
|
include ActualFermentable
|
8
8
|
|
9
|
-
def initialize(raw, soaked,
|
10
|
-
@raw = raw
|
11
|
-
@soaked = soaked
|
12
|
-
@
|
13
|
-
@
|
14
|
-
@
|
15
|
-
@
|
16
|
-
@dekoji = dekoji
|
9
|
+
def initialize(raw, soaked, steamed, cooled, tanekoji, dekoji)
|
10
|
+
@raw = raw.to_f
|
11
|
+
@soaked = soaked.to_f
|
12
|
+
@steamed = steamed.to_f
|
13
|
+
@cooled = cooled.to_f
|
14
|
+
@tanekoji = tanekoji.to_f
|
15
|
+
@dekoji = dekoji.to_f
|
17
16
|
end
|
18
17
|
|
19
18
|
def *(other)
|
20
19
|
if Integer===other || Float===other
|
21
|
-
Actual.new(raw * other, soaked * other,
|
20
|
+
Actual.new(raw * other, soaked * other, steamed * other, cooled * other, tanekoji * other, dekoji * other)
|
22
21
|
else
|
23
22
|
x, y = other.coerce(self)
|
24
23
|
x * y
|
@@ -23,7 +23,7 @@ module Toji
|
|
23
23
|
|
24
24
|
def +(other)
|
25
25
|
if Base===other
|
26
|
-
Actual.new(raw + other.raw, soaked + other.soaked,
|
26
|
+
Actual.new(raw + other.raw, soaked + other.soaked, steamed + other.steamed, cooled + other.cooled, tanekoji + other.tanekoji, dekoji + other.dekoji)
|
27
27
|
else
|
28
28
|
x, y = other.coerce(self)
|
29
29
|
x + y
|
@@ -10,14 +10,14 @@ module Toji
|
|
10
10
|
soaked - raw
|
11
11
|
end
|
12
12
|
|
13
|
-
def before_steaming_rate
|
14
|
-
# TODO
|
15
|
-
end
|
16
|
-
|
17
13
|
def steamed_rate
|
18
14
|
(steamed - raw) / raw
|
19
15
|
end
|
20
16
|
|
17
|
+
def steaming_water
|
18
|
+
steamed - raw
|
19
|
+
end
|
20
|
+
|
21
21
|
def cooled_rate
|
22
22
|
(cooled - raw) / raw
|
23
23
|
end
|
@@ -4,32 +4,20 @@ module Toji
|
|
4
4
|
# 浸漬米吸水率
|
5
5
|
attr_reader :soaked_rate
|
6
6
|
|
7
|
-
# 蒸し前浸漬米吸水率
|
8
|
-
# 炊飯の場合は水を追加
|
9
|
-
# 蒸しの場合は一晩経って蒸発した分を削減
|
10
|
-
attr_reader :before_steaming_rate
|
11
|
-
|
12
7
|
# 蒸米吸水率
|
13
8
|
attr_reader :steamed_rate
|
14
9
|
|
15
10
|
# 放冷後蒸米吸水率
|
16
11
|
attr_reader :cooled_rate
|
17
12
|
|
18
|
-
def initialize(soaked_rate,
|
13
|
+
def initialize(soaked_rate, steamed_rate, cooled_rate)
|
19
14
|
@soaked_rate = soaked_rate
|
20
|
-
@before_steaming_rate = before_steaming_rate
|
21
15
|
@steamed_rate = steamed_rate
|
22
16
|
@cooled_rate = cooled_rate
|
23
17
|
end
|
24
18
|
|
25
|
-
def before_steaming_rate
|
26
|
-
@before_steaming_rate || begin
|
27
|
-
@soaked_rate - 0.04
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
19
|
|
32
|
-
DEFAULT = new(0.33,
|
20
|
+
DEFAULT = new(0.33, 0.41, 0.33)
|
33
21
|
end
|
34
22
|
end
|
35
23
|
end
|
data/lib/toji/product/event.rb
CHANGED
data/lib/toji/recipe.rb
CHANGED
@@ -15,9 +15,9 @@ module Toji
|
|
15
15
|
}
|
16
16
|
end
|
17
17
|
|
18
|
-
def round(ndigit=0, half: :up)
|
18
|
+
def round(ndigit=0, mini_ndigit=nil, half: :up)
|
19
19
|
new_steps = steps.map {|step|
|
20
|
-
step.round(ndigit, half: half)
|
20
|
+
step.round(ndigit, mini_ndigit, half: half)
|
21
21
|
}
|
22
22
|
|
23
23
|
self.class.new.tap {|o|
|
@@ -25,15 +25,6 @@ module Toji
|
|
25
25
|
}
|
26
26
|
end
|
27
27
|
|
28
|
-
# 内容量の累計
|
29
|
-
def cumulative_weight_totals
|
30
|
-
weight_total = steps.map(&:weight_total)
|
31
|
-
|
32
|
-
weight_total.map.with_index {|x,i|
|
33
|
-
weight_total[0..i].inject(:+)
|
34
|
-
}
|
35
|
-
end
|
36
|
-
|
37
28
|
# 総米の累計
|
38
29
|
def cumulative_rice_totals
|
39
30
|
rice_total = steps.map(&:rice_total)
|