toji 2.8.0 → 2.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/example/calendar.ipynb +42 -51
  3. data/example/calendar.yaml +6 -6
  4. data/example/calendar_file.ipynb +36 -36
  5. data/example/example_core.rb +877 -205
  6. data/example/kake_ingredient.rb +21 -15
  7. data/example/koji_ingredient.rb +31 -21
  8. data/example/{koji_making.ipynb → koji_progress.ipynb} +14 -14
  9. data/example/{koji_making.rb → koji_progress.rb} +3 -2
  10. data/example/{koji_making.yaml → koji_progress.yaml} +8 -9
  11. data/example/{koji_making_multi.ipynb → koji_progress_multi.ipynb} +21 -22
  12. data/example/{moromi.ipynb → moromi_progress.ipynb} +22 -22
  13. data/example/{moromi.rb → moromi_progress.rb} +3 -2
  14. data/example/{moromi.yaml → moromi_progress.yaml} +0 -0
  15. data/example/moto_progress.ipynb +121 -0
  16. data/example/{moto.rb → moto_progress.rb} +3 -2
  17. data/example/{moto.yaml → moto_progress.yaml} +14 -15
  18. data/example/recipe.rb +44 -32
  19. data/lib/toji.rb +4 -1
  20. data/lib/toji/calendar.rb +18 -18
  21. data/lib/toji/calendar/date_column.rb +7 -22
  22. data/lib/toji/calendar/date_row.rb +6 -6
  23. data/lib/toji/ingredient.rb +6 -2
  24. data/lib/toji/ingredient/alcohol.rb +14 -0
  25. data/lib/toji/ingredient/base.rb +11 -0
  26. data/lib/toji/ingredient/kake.rb +3 -9
  27. data/lib/toji/ingredient/koji.rb +19 -10
  28. data/lib/toji/ingredient/lactic_acid.rb +14 -0
  29. data/lib/toji/ingredient/rice.rb +50 -4
  30. data/lib/toji/ingredient/tanekoji.rb +29 -0
  31. data/lib/toji/ingredient/water.rb +18 -0
  32. data/lib/toji/ingredient/yeast.rb +20 -0
  33. data/lib/toji/processing.rb +18 -0
  34. data/lib/toji/processing/base.rb +7 -0
  35. data/lib/toji/processing/cooled_rice.rb +22 -0
  36. data/lib/toji/processing/cooled_rice_element.rb +8 -0
  37. data/lib/toji/processing/dekoji.rb +22 -0
  38. data/lib/toji/processing/dekoji_element.rb +8 -0
  39. data/lib/toji/processing/kake_processing.rb +7 -0
  40. data/lib/toji/processing/koji_processing.rb +10 -0
  41. data/lib/toji/processing/rice_processing.rb +19 -0
  42. data/lib/toji/processing/soaked_rice.rb +49 -0
  43. data/lib/toji/processing/soaked_rice_element.rb +18 -0
  44. data/lib/toji/processing/steamed_rice.rb +22 -0
  45. data/lib/toji/processing/steamed_rice_element.rb +8 -0
  46. data/lib/toji/product.rb +11 -83
  47. data/lib/toji/product/schedule_factory.rb +74 -0
  48. data/lib/toji/progress.rb +23 -0
  49. data/lib/toji/progress/base_progress.rb +37 -0
  50. data/lib/toji/progress/base_state.rb +39 -0
  51. data/lib/toji/progress/builder.rb +53 -0
  52. data/lib/toji/progress/graph.rb +11 -0
  53. data/lib/toji/{brew → progress}/graph/ab.rb +4 -4
  54. data/lib/toji/{brew → progress}/graph/bmd.rb +2 -2
  55. data/lib/toji/{brew/graph/multi_progress.rb → progress/graph/multi_progress_note.rb} +11 -11
  56. data/lib/toji/{brew/graph/progress.rb → progress/graph/progress_note.rb} +20 -18
  57. data/lib/toji/progress/koji_progress.rb +15 -0
  58. data/lib/toji/progress/koji_state.rb +23 -0
  59. data/lib/toji/{brew/moromi.rb → progress/moromi_progress.rb} +9 -5
  60. data/lib/toji/progress/moromi_state.rb +77 -0
  61. data/lib/toji/progress/moto_progress.rb +15 -0
  62. data/lib/toji/progress/moto_state.rb +31 -0
  63. data/lib/toji/progress/progress.rb +15 -0
  64. data/lib/toji/progress/state.rb +9 -0
  65. data/lib/toji/progress/state/baume_to_nihonshudo.rb +21 -0
  66. data/lib/toji/progress/state/nihonshudo_to_baume.rb +21 -0
  67. data/lib/toji/recipe.rb +54 -39
  68. data/lib/toji/recipe/ab_expect.rb +2 -2
  69. data/lib/toji/recipe/action.rb +8 -0
  70. data/lib/toji/recipe/step.rb +97 -71
  71. data/lib/toji/schedule.rb +5 -0
  72. data/lib/toji/schedule/action_schedule.rb +9 -0
  73. data/lib/toji/schedule/base.rb +9 -0
  74. data/lib/toji/schedule/kake_schedule.rb +11 -0
  75. data/lib/toji/schedule/koji_schedule.rb +11 -0
  76. data/lib/toji/schedule/rice_schedule.rb +16 -0
  77. data/lib/toji/utils.rb +43 -0
  78. data/lib/toji/version.rb +1 -1
  79. metadata +59 -40
  80. data/lib/toji/brew.rb +0 -18
  81. data/lib/toji/brew/base.rb +0 -55
  82. data/lib/toji/brew/builder.rb +0 -98
  83. data/lib/toji/brew/graph.rb +0 -11
  84. data/lib/toji/brew/koji.rb +0 -11
  85. data/lib/toji/brew/moto.rb +0 -11
  86. data/lib/toji/brew/state.rb +0 -122
  87. data/lib/toji/brew/wrapped_state.rb +0 -109
  88. data/lib/toji/ingredient/kake/actual.rb +0 -26
  89. data/lib/toji/ingredient/kake/base.rb +0 -18
  90. data/lib/toji/ingredient/kake/expected.rb +0 -40
  91. data/lib/toji/ingredient/koji/actual.rb +0 -29
  92. data/lib/toji/ingredient/koji/actual_fermentable.rb +0 -15
  93. data/lib/toji/ingredient/koji/base.rb +0 -35
  94. data/lib/toji/ingredient/koji/expected.rb +0 -45
  95. data/lib/toji/ingredient/koji/expected_fermentable.rb +0 -15
  96. data/lib/toji/ingredient/koji_rate.rb +0 -16
  97. data/lib/toji/ingredient/rice/actual_steamable.rb +0 -27
  98. data/lib/toji/ingredient/rice/base.rb +0 -40
  99. data/lib/toji/ingredient/rice/expected_steamable.rb +0 -27
  100. data/lib/toji/ingredient/rice_rate.rb +0 -23
  101. data/lib/toji/product/event.rb +0 -13
  102. data/lib/toji/product/rice_event.rb +0 -28
  103. data/lib/toji/product/rice_event_group.rb +0 -19
@@ -1,109 +0,0 @@
1
- require 'forwardable'
2
-
3
- module Toji
4
- module Brew
5
- class WrappedState
6
- extend Forwardable
7
-
8
- attr_accessor :elapsed_time
9
- attr_accessor :time
10
- attr_reader :state
11
- attr_reader :brew
12
-
13
- def_delegators :@state, :mark
14
- def_delegators :@state, :temps
15
- def_delegators :@state, :preset_temp
16
- def_delegators :@state, :room_temp
17
- def_delegators :@state, :room_psychrometry
18
- def_delegators :@state, :acid
19
- def_delegators :@state, :amino_acid
20
- def_delegators :@state, :alcohol
21
- def_delegators :@state, :warmings
22
- def_delegators :@state, :note
23
-
24
- def initialize(state, brew)
25
- @elapsed_time = state.elapsed_time
26
- @time = state.time
27
- @state = state
28
- @brew = brew
29
- end
30
-
31
- def day
32
- ((elapsed_time_with_offset.to_f + 1) / DAY).ceil
33
- end
34
-
35
- def day_label
36
- @brew.day_labels[day - 1]
37
- end
38
-
39
- def elapsed_time_with_offset
40
- @elapsed_time + @brew.day_offset
41
- end
42
-
43
- def baume
44
- if @state.baume
45
- @state.baume
46
- elsif @state.nihonshudo
47
- @state.nihonshudo * -0.1
48
- end
49
- end
50
-
51
- def nihonshudo
52
- if @state.nihonshudo
53
- @state.nihonshudo
54
- elsif @state.baume
55
- @state.baume * -10
56
- end
57
- end
58
-
59
- def display_baume
60
- if @state.baume || @state.nihonshudo
61
- b = baume
62
- if b<3.0
63
- nihonshudo
64
- else
65
- b
66
- end
67
- end
68
- end
69
-
70
- def display_time(format="%m/%d %H:%M")
71
- if @time
72
- @time.strftime(format)
73
- elsif @brew.base_time
74
- time = @brew.base_time + @elapsed_time
75
- time.strftime(format)
76
- else
77
- utc_offset = Time.at(0).utc_offset
78
- Time.at(@elapsed_time - utc_offset).strftime(format)
79
- end
80
- end
81
-
82
- def moromi_day
83
- _tome_day = @brew.moromi_tome_day
84
- _now_day = day
85
-
86
- if _tome_day && _tome_day < _now_day
87
- _now_day - _tome_day + 1
88
- end
89
- end
90
-
91
- def bmd
92
- _moromi_day = moromi_day
93
- _baume = baume
94
-
95
- if _moromi_day && _baume
96
- _moromi_day * _baume
97
- end
98
- end
99
-
100
- def expected_alcohol(target_alc, target_nihonshudo, coef)
101
- _baume = baume
102
-
103
- if _baume
104
- target_alc - (_baume - target_nihonshudo * -0.1) * coef
105
- end
106
- end
107
- end
108
- end
109
- end
@@ -1,26 +0,0 @@
1
- module Toji
2
- module Ingredient
3
- module Kake
4
- class Actual
5
- include Base
6
- include Rice::ActualSteamable
7
-
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
13
- end
14
-
15
- def *(other)
16
- if Integer===other || Float===other
17
- Actual.new(raw * other, soaked * other, steamed * other, cooled * other)
18
- else
19
- x, y = other.coerce(self)
20
- x * y
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,18 +0,0 @@
1
- module Toji
2
- module Ingredient
3
- module Kake
4
- module Base
5
- include Rice::Base
6
-
7
- def +(other)
8
- if Base===other
9
- Actual.new(raw + other.raw, soaked + other.soaked, steamed + other.steamed, cooled + other.cooled)
10
- else
11
- x, y = other.coerce(self)
12
- x + y
13
- end
14
- end
15
- end
16
- end
17
- end
18
- end
@@ -1,40 +0,0 @@
1
- module Toji
2
- module Ingredient
3
- module Kake
4
- class Expected
5
- include Base
6
- include Rice::ExpectedSteamable
7
-
8
- def initialize(raw, rice_rate: RiceRate::DEFAULT)
9
- @raw = raw.to_f
10
-
11
- @rice_rate = rice_rate
12
- @soaked_rate = rice_rate.soaked_rate
13
- @steamed_rate = rice_rate.steamed_rate
14
- @cooled_rate = rice_rate.cooled_rate
15
- end
16
-
17
- def round(ndigit=0, half: :up)
18
- self.class.new(@raw.round(ndigit, half: half), rice_rate: @rice_rate)
19
- end
20
-
21
- def *(other)
22
- if Integer===other || Float===other
23
- self.class.new(@raw * other, rice_rate: @rice_rate)
24
- else
25
- x, y = other.coerce(self)
26
- x * y
27
- end
28
- end
29
-
30
- def self.create(x)
31
- if self===x
32
- x
33
- else
34
- new(x)
35
- end
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,29 +0,0 @@
1
- module Toji
2
- module Ingredient
3
- module Koji
4
- class Actual
5
- include Base
6
- include Rice::ActualSteamable
7
- include ActualFermentable
8
-
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
16
- end
17
-
18
- def *(other)
19
- if Integer===other || Float===other
20
- Actual.new(raw * other, soaked * other, steamed * other, cooled * other, tanekoji * other, dekoji * other)
21
- else
22
- x, y = other.coerce(self)
23
- x * y
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,15 +0,0 @@
1
- module Toji
2
- module Ingredient
3
- module Koji
4
- module ActualFermentable
5
- def tanekoji_rate
6
- tanekoji / raw
7
- end
8
-
9
- def dekoji_rate
10
- (dekoji - raw) / raw
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,35 +0,0 @@
1
- module Toji
2
- module Ingredient
3
- module Koji
4
- module Base
5
- include Rice::Base
6
-
7
- # 種麹
8
- #
9
- # 総破精麹を造るには、種麹の量を麹米100kgあたり種麹100gとする
10
- # 突き破精麹を造るには、種麹の量を麹米100kgあたり種麹80gとする
11
- #
12
- # 出典: 酒造教本 P66
13
- attr_reader :tanekoji_rate
14
- attr_reader :tanekoji
15
-
16
- # 出麹歩合
17
- #
18
- # 出麹歩合17〜19%のものが麹菌の繁殖のほどよい麹である
19
- #
20
- # 出典: 酒造教本 P67
21
- attr_reader :dekoji_rate
22
- attr_reader :dekoji
23
-
24
- def +(other)
25
- if Base===other
26
- Actual.new(raw + other.raw, soaked + other.soaked, steamed + other.steamed, cooled + other.cooled, tanekoji + other.tanekoji, dekoji + other.dekoji)
27
- else
28
- x, y = other.coerce(self)
29
- x + y
30
- end
31
- end
32
- end
33
- end
34
- end
35
- end
@@ -1,45 +0,0 @@
1
- module Toji
2
- module Ingredient
3
- module Koji
4
- class Expected
5
- include Base
6
- include Rice::ExpectedSteamable
7
- include ExpectedFermentable
8
-
9
- def initialize(raw, rice_rate: RiceRate::DEFAULT, koji_rate: KojiRate::DEFAULT)
10
- @raw = raw.to_f
11
-
12
- @rice_rate = rice_rate
13
- @soaked_rate = rice_rate.soaked_rate
14
- @steamed_rate = rice_rate.steamed_rate
15
- @cooled_rate = rice_rate.cooled_rate
16
-
17
- @koji_rate = koji_rate
18
- @tanekoji_rate = koji_rate.tanekoji_rate
19
- @dekoji_rate = koji_rate.dekoji_rate
20
- end
21
-
22
- def round(ndigit=0, half: :up)
23
- self.class.new(@raw.round(ndigit, half: half), rice_rate: @rice_rate, koji_rate: @koji_rate)
24
- end
25
-
26
- def self.create(x)
27
- if self===x
28
- x
29
- else
30
- new(x)
31
- end
32
- end
33
-
34
- def *(other)
35
- if Integer===other || Float===other
36
- Expected.new(@raw * other, rice_rate: @rice_rate, koji_rate: @koji_rate)
37
- else
38
- x, y = other.coerce(self)
39
- x * y
40
- end
41
- end
42
- end
43
- end
44
- end
45
- end
@@ -1,15 +0,0 @@
1
- module Toji
2
- module Ingredient
3
- module Koji
4
- module ExpectedFermentable
5
- def tanekoji
6
- raw * tanekoji_rate
7
- end
8
-
9
- def dekoji
10
- raw + raw * dekoji_rate
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,16 +0,0 @@
1
- module Toji
2
- module Ingredient
3
- class KojiRate
4
- attr_reader :tanekoji_rate
5
- attr_reader :dekoji_rate
6
-
7
- def initialize(tanekoji_rate, dekoji_rate)
8
- @tanekoji_rate = tanekoji_rate
9
- @dekoji_rate = dekoji_rate
10
- end
11
-
12
- DEFAULT = new(0.001, 0.18)
13
- end
14
- end
15
- end
16
-
@@ -1,27 +0,0 @@
1
- module Toji
2
- module Ingredient
3
- module Rice
4
- module ActualSteamable
5
- def soaked_rate
6
- soaking_water / raw
7
- end
8
-
9
- def soaking_water
10
- soaked - raw
11
- end
12
-
13
- def steamed_rate
14
- (steamed - raw) / raw
15
- end
16
-
17
- def steaming_water
18
- steamed - raw
19
- end
20
-
21
- def cooled_rate
22
- (cooled - raw) / raw
23
- end
24
- end
25
- end
26
- end
27
- end
@@ -1,40 +0,0 @@
1
- module Toji
2
- module Ingredient
3
- module Rice
4
- module Base
5
- # 白米
6
- attr_reader :raw
7
-
8
- # 浸漬米吸水率
9
- #
10
- # 標準的な白米吸水率は掛米で30〜35%、麹米で33%前後で許容範囲はかなり狭い
11
- #
12
- # 出典: 酒造教本 P38
13
- attr_reader :soaked_rate
14
- attr_reader :soaking_water
15
- attr_reader :soaked
16
-
17
- # 蒸米吸水率
18
- #
19
- # 蒸しにより通常甑置き前の浸漬白米の重量よりさらに12〜13%吸水する
20
- # 蒸しにより吸水の増加が13%を超える場合は、蒸米の表面が柔らかくべとつく蒸米になりやすい
21
- # 蒸米吸水率は麹米及び酒母米で41〜43%、掛米は39〜40%で、吟醸造りの場合は数%低い
22
- #
23
- # 出典: 酒造教本 P48
24
- attr_reader :steamed_rate
25
- attr_reader :steaming_water
26
- attr_reader :steamed
27
-
28
- # 放冷
29
- #
30
- # 冷却法で若干異なるが蒸米の冷却により掛米で白米重量の10%、麹米で8%程度の水が失われる
31
- # 出典: 酒造教本 P49
32
- #
33
- # 麹を造るのに適した蒸米は、引込時の吸水率が33%を理想とし、許容幅はプラスマイナス1%である
34
- # 出典: 酒造教本 P59
35
- attr_reader :cooled_rate
36
- attr_reader :cooled
37
- end
38
- end
39
- end
40
- end
@@ -1,27 +0,0 @@
1
- module Toji
2
- module Ingredient
3
- module Rice
4
- module ExpectedSteamable
5
- def soaking_water
6
- raw * soaked_rate
7
- end
8
-
9
- def soaked
10
- raw + raw * soaked_rate
11
- end
12
-
13
- def steaming_water
14
- raw * steamed_rate
15
- end
16
-
17
- def steamed
18
- raw + raw * steamed_rate
19
- end
20
-
21
- def cooled
22
- raw + raw * cooled_rate
23
- end
24
- end
25
- end
26
- end
27
- end