toji 1.6.8 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/example/calendar.ipynb +383 -0
  3. data/example/{schedule.yaml → calendar.yaml} +6 -30
  4. data/example/calendar_file.ipynb +338 -0
  5. data/example/example_core.rb +354 -0
  6. data/example/kake_ingredient.rb +26 -0
  7. data/example/{koji_recipe.rb → koji_ingredient.rb} +1 -2
  8. data/example/koji_making.ipynb +16 -15
  9. data/example/koji_making.rb +2 -1
  10. data/example/koji_making.yaml +10 -9
  11. data/example/koji_making_multi.ipynb +27 -61
  12. data/example/moromi.ipynb +25 -24
  13. data/example/moromi.rb +1 -0
  14. data/example/moromi.yaml +10 -4
  15. data/example/recipe.rb +75 -0
  16. data/example/shubo.ipynb +15 -14
  17. data/example/shubo.rb +2 -1
  18. data/example/shubo.yaml +12 -11
  19. data/lib/toji.rb +3 -1
  20. data/lib/toji/brew.rb +4 -3
  21. data/lib/toji/brew/base.rb +8 -92
  22. data/lib/toji/brew/builder.rb +77 -6
  23. data/lib/toji/brew/graph/bmd.rb +1 -2
  24. data/lib/toji/brew/graph/multi_progress.rb +0 -121
  25. data/lib/toji/brew/graph/progress.rb +17 -52
  26. data/lib/toji/brew/koji.rb +2 -11
  27. data/lib/toji/brew/moromi.rb +4 -37
  28. data/lib/toji/brew/shubo.rb +2 -6
  29. data/lib/toji/brew/state.rb +90 -103
  30. data/lib/toji/brew/wrapped_state.rb +136 -0
  31. data/lib/toji/calendar.rb +123 -0
  32. data/lib/toji/{schedule → calendar}/date_column.rb +3 -6
  33. data/lib/toji/{schedule → calendar}/date_row.rb +6 -6
  34. data/lib/toji/ingredient.rb +10 -0
  35. data/lib/toji/ingredient/kake.rb +17 -0
  36. data/lib/toji/ingredient/kake/actual.rb +26 -0
  37. data/lib/toji/ingredient/kake/base.rb +18 -0
  38. data/lib/toji/ingredient/kake/expected.rb +40 -0
  39. data/lib/toji/ingredient/koji.rb +19 -0
  40. data/lib/toji/ingredient/koji/actual.rb +29 -0
  41. data/lib/toji/ingredient/koji/actual_fermentable.rb +15 -0
  42. data/lib/toji/ingredient/koji/base.rb +35 -0
  43. data/lib/toji/ingredient/koji/expected.rb +45 -0
  44. data/lib/toji/ingredient/koji/expected_fermentable.rb +15 -0
  45. data/lib/toji/{recipe → ingredient}/koji_rate.rb +1 -1
  46. data/lib/toji/ingredient/rice.rb +10 -0
  47. data/lib/toji/ingredient/rice/actual_steamable.rb +27 -0
  48. data/lib/toji/ingredient/rice/base.rb +40 -0
  49. data/lib/toji/ingredient/rice/expected_steamable.rb +27 -0
  50. data/lib/toji/ingredient/rice_rate.rb +23 -0
  51. data/lib/toji/product.rb +65 -0
  52. data/lib/toji/{schedule/product_event.rb → product/event.rb} +4 -4
  53. data/lib/toji/recipe.rb +111 -5
  54. data/lib/toji/recipe/step.rb +49 -64
  55. data/lib/toji/version.rb +1 -1
  56. metadata +33 -39
  57. data/example/rice_recipe.rb +0 -28
  58. data/example/schedule.ipynb +0 -393
  59. data/example/schedule_file.ipynb +0 -337
  60. data/example/three_step_mashing_recipe.rb +0 -67
  61. data/lib/toji/brew/state_accessor.rb +0 -13
  62. data/lib/toji/brew/state_record.rb +0 -72
  63. data/lib/toji/recipe/ingredient.rb +0 -10
  64. data/lib/toji/recipe/ingredient/koji.rb +0 -21
  65. data/lib/toji/recipe/ingredient/koji/actual.rb +0 -32
  66. data/lib/toji/recipe/ingredient/koji/actual_fermentable.rb +0 -17
  67. data/lib/toji/recipe/ingredient/koji/base.rb +0 -37
  68. data/lib/toji/recipe/ingredient/koji/expected.rb +0 -48
  69. data/lib/toji/recipe/ingredient/koji/expected_fermentable.rb +0 -17
  70. data/lib/toji/recipe/ingredient/rice.rb +0 -21
  71. data/lib/toji/recipe/ingredient/rice/actual.rb +0 -29
  72. data/lib/toji/recipe/ingredient/rice/actual_steamable.rb +0 -29
  73. data/lib/toji/recipe/ingredient/rice/base.rb +0 -51
  74. data/lib/toji/recipe/ingredient/rice/expected.rb +0 -43
  75. data/lib/toji/recipe/ingredient/rice/expected_steamable.rb +0 -31
  76. data/lib/toji/recipe/ingredient/yeast.rb +0 -21
  77. data/lib/toji/recipe/rice_rate.rb +0 -10
  78. data/lib/toji/recipe/rice_rate/base.rb +0 -21
  79. data/lib/toji/recipe/rice_rate/cooked.rb +0 -67
  80. data/lib/toji/recipe/rice_rate/steamed.rb +0 -30
  81. data/lib/toji/recipe/three_step_mashing.rb +0 -274
  82. data/lib/toji/recipe/yeast_rate.rb +0 -41
  83. data/lib/toji/schedule.rb +0 -11
  84. data/lib/toji/schedule/calendar.rb +0 -139
  85. data/lib/toji/schedule/date_interval_enumerator.rb +0 -45
  86. data/lib/toji/schedule/product.rb +0 -117
@@ -1,10 +0,0 @@
1
- require 'toji/recipe/ingredient/rice'
2
- require 'toji/recipe/ingredient/koji'
3
- require 'toji/recipe/ingredient/yeast'
4
-
5
- module Toji
6
- module Recipe
7
- module Ingredient
8
- end
9
- end
10
- end
@@ -1,21 +0,0 @@
1
- require 'toji/recipe/ingredient/koji/base'
2
- require 'toji/recipe/ingredient/koji/expected_fermentable'
3
- require 'toji/recipe/ingredient/koji/expected'
4
- require 'toji/recipe/ingredient/koji/actual_fermentable'
5
- require 'toji/recipe/ingredient/koji/actual'
6
-
7
- module Toji
8
- module Recipe
9
- module Ingredient
10
- module Koji
11
- def self.expected(raw, rice_rate: Recipe::RiceRate::Cooked::DEFAULT, koji_rate: Recipe::KojiRate::DEFAULT)
12
- Expected.new(raw, rice_rate: rice_rate, koji_rate: koji_rate)
13
- end
14
-
15
- def self.actual(raw, soaked, steaming_water, steamed, cooled, tanekoji, dekoji)
16
- Actual.new(raw, soaked, steaming_water, steamed, cooled, tanekoji, dekoji)
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,32 +0,0 @@
1
- module Toji
2
- module Recipe
3
- module Ingredient
4
- module Koji
5
- class Actual
6
- include Base
7
- include Rice::ActualSteamable
8
- include ActualFermentable
9
-
10
- def initialize(raw, soaked, steaming_water, steamed, cooled, tanekoji, dekoji)
11
- @raw = raw
12
- @soaked = soaked
13
- @steaming_water = steaming_water
14
- @steamed = steamed
15
- @cooled = cooled
16
- @tanekoji = tanekoji
17
- @dekoji = dekoji
18
- end
19
-
20
- def *(other)
21
- if Integer===other || Float===other
22
- Actual.new(raw * other, soaked * other, steaming_water * other, steamed * other, cooled * other, tanekoji * other, dekoji * other)
23
- else
24
- x, y = other.coerce(self)
25
- x * y
26
- end
27
- end
28
- end
29
- end
30
- end
31
- end
32
- end
@@ -1,17 +0,0 @@
1
- module Toji
2
- module Recipe
3
- module Ingredient
4
- module Koji
5
- module ActualFermentable
6
- def tanekoji_rate
7
- tanekoji / raw
8
- end
9
-
10
- def dekoji_rate
11
- (dekoji - raw) / raw
12
- end
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,37 +0,0 @@
1
- module Toji
2
- module Recipe
3
- module Ingredient
4
- module Koji
5
- module Base
6
- include Rice::Base
7
-
8
- # 種麹
9
- #
10
- # 総破精麹を造るには、種麹の量を麹米100kgあたり種麹100gとする
11
- # 突き破精麹を造るには、種麹の量を麹米100kgあたり種麹80gとする
12
- #
13
- # 出典: 酒造教本 P66
14
- attr_reader :tanekoji_rate
15
- attr_reader :tanekoji
16
-
17
- # 出麹歩合
18
- #
19
- # 出麹歩合17〜19%のものが麹菌の繁殖のほどよい麹である
20
- #
21
- # 出典: 酒造教本 P67
22
- attr_reader :dekoji_rate
23
- attr_reader :dekoji
24
-
25
- def +(other)
26
- if Base===other
27
- Actual.new(raw + other.raw, soaked + other.soaked, steaming_water + other.steaming_water, steamed + other.steamed, cooled + other.cooled, tanekoji + other.tanekoji, dekoji + other.dekoji)
28
- else
29
- x, y = other.coerce(self)
30
- x + y
31
- end
32
- end
33
- end
34
- end
35
- end
36
- end
37
- end
@@ -1,48 +0,0 @@
1
- module Toji
2
- module Recipe
3
- module Ingredient
4
- module Koji
5
- class Expected
6
- include Base
7
- include Rice::ExpectedSteamable
8
- include ExpectedFermentable
9
-
10
- def initialize(raw, rice_rate: Recipe::RiceRate::Cooked::DEFAULT, koji_rate: Recipe::KojiRate::DEFAULT)
11
- @raw = raw.to_f
12
-
13
- @rice_rate = rice_rate
14
- @soaked_rate = rice_rate.soaked_rate
15
- @before_steaming_rate = rice_rate.before_steaming_rate
16
- @steamed_rate = rice_rate.steamed_rate
17
- @cooled_rate = rice_rate.cooled_rate
18
-
19
- @koji_rate = koji_rate
20
- @tanekoji_rate = koji_rate.tanekoji_rate
21
- @dekoji_rate = koji_rate.dekoji_rate
22
- end
23
-
24
- def round(ndigit=0, half: :up)
25
- self.class.new(@raw.round(ndigit, half: half), rice_rate: @rice_rate, koji_rate: @koji_rate)
26
- end
27
-
28
- def self.create(x)
29
- if self===x
30
- x
31
- else
32
- new(x)
33
- end
34
- end
35
-
36
- def *(other)
37
- if Integer===other || Float===other
38
- Expected.new(@raw * other, rice_rate: @rice_rate, koji_rate: @koji_rate)
39
- else
40
- x, y = other.coerce(self)
41
- x * y
42
- end
43
- end
44
- end
45
- end
46
- end
47
- end
48
- end
@@ -1,17 +0,0 @@
1
- module Toji
2
- module Recipe
3
- module Ingredient
4
- module Koji
5
- module ExpectedFermentable
6
- def tanekoji
7
- @raw * @tanekoji_rate
8
- end
9
-
10
- def dekoji
11
- @raw + @raw * @dekoji_rate
12
- end
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,21 +0,0 @@
1
- require 'toji/recipe/ingredient/rice/base'
2
- require 'toji/recipe/ingredient/rice/expected_steamable'
3
- require 'toji/recipe/ingredient/rice/expected'
4
- require 'toji/recipe/ingredient/rice/actual_steamable'
5
- require 'toji/recipe/ingredient/rice/actual'
6
-
7
- module Toji
8
- module Recipe
9
- module Ingredient
10
- module Rice
11
- def self.expected(raw, rice_rate: Recipe::RiceRate::Cooked::DEFAULT)
12
- Expected.new(raw, rice_rate: rice_rate)
13
- end
14
-
15
- def self.actual(raw, soaked, steaming_water, steamed, cooled)
16
- Actual.new(raw, soaked, steaming_water, steamed, cooled)
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,29 +0,0 @@
1
- module Toji
2
- module Recipe
3
- module Ingredient
4
- module Rice
5
- class Actual
6
- include Base
7
- include ActualSteamable
8
-
9
- def initialize(raw, soaked, steaming_water, steamed, cooled)
10
- @raw = raw
11
- @soaked = soaked
12
- @steaming_water = steaming_water
13
- @steamed = steamed
14
- @cooled = cooled
15
- end
16
-
17
- def *(other)
18
- if Integer===other || Float===other
19
- Actual.new(raw * other, soaked * other, steaming_water * other, steamed * other, cooled * other)
20
- else
21
- x, y = other.coerce(self)
22
- x * y
23
- end
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,29 +0,0 @@
1
- module Toji
2
- module Recipe
3
- module Ingredient
4
- module Rice
5
- module ActualSteamable
6
- def soaked_rate
7
- soaking_water / raw
8
- end
9
-
10
- def soaking_water
11
- soaked - raw
12
- end
13
-
14
- def before_steaming_rate
15
- # TODO
16
- end
17
-
18
- def steamed_rate
19
- (steamed - raw) / raw
20
- end
21
-
22
- def cooled_rate
23
- (cooled - raw) / raw
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,51 +0,0 @@
1
- module Toji
2
- module Recipe
3
- module Ingredient
4
- module Rice
5
- module Base
6
- # 白米
7
- attr_reader :raw
8
-
9
- # 浸漬米吸水率
10
- #
11
- # 標準的な白米吸水率は掛米で30〜35%、麹米で33%前後で許容範囲はかなり狭い
12
- #
13
- # 出典: 酒造教本 P38
14
- attr_reader :soaked_rate
15
- attr_reader :soaking_water
16
- attr_reader :soaked
17
-
18
- # 蒸米吸水率
19
- #
20
- # 蒸しにより通常甑置き前の浸漬白米の重量よりさらに12〜13%吸水する
21
- # 蒸しにより吸水の増加が13%を超える場合は、蒸米の表面が柔らかくべとつく蒸米になりやすい
22
- # 蒸米吸水率は麹米及び酒母米で41〜43%、掛米は39〜40%で、吟醸造りの場合は数%低い
23
- #
24
- # 出典: 酒造教本 P48
25
- attr_reader :steamed_rate
26
- attr_reader :steaming_water
27
- attr_reader :steamed
28
-
29
- # 放冷
30
- #
31
- # 冷却法で若干異なるが蒸米の冷却により掛米で白米重量の10%、麹米で8%程度の水が失われる
32
- # 出典: 酒造教本 P49
33
- #
34
- # 麹を造るのに適した蒸米は、引込時の吸水率が33%を理想とし、許容幅はプラスマイナス1%である
35
- # 出典: 酒造教本 P59
36
- attr_reader :cooled_rate
37
- attr_reader :cooled
38
-
39
- def +(other)
40
- if Base===other
41
- Actual.new(raw + other.raw, soaked + other.soaked, steaming_water + other.steaming_water, steamed + other.steamed, cooled + other.cooled)
42
- else
43
- x, y = other.coerce(self)
44
- x + y
45
- end
46
- end
47
- end
48
- end
49
- end
50
- end
51
- end
@@ -1,43 +0,0 @@
1
- module Toji
2
- module Recipe
3
- module Ingredient
4
- module Rice
5
- class Expected
6
- include Base
7
- include ExpectedSteamable
8
-
9
- def initialize(raw, rice_rate: Recipe::RiceRate::Cooked::DEFAULT)
10
- @raw = raw.to_f
11
-
12
- @rice_rate = rice_rate
13
- @soaked_rate = rice_rate.soaked_rate
14
- @before_steaming_rate = rice_rate.before_steaming_rate
15
- @steamed_rate = rice_rate.steamed_rate
16
- @cooled_rate = rice_rate.cooled_rate
17
- end
18
-
19
- def round(ndigit=0, half: :up)
20
- self.class.new(@raw.round(ndigit, half: half), rice_rate: @rice_rate)
21
- end
22
-
23
- def *(other)
24
- if Integer===other || Float===other
25
- self.class.new(@raw * other, rice_rate: @rice_rate)
26
- else
27
- x, y = other.coerce(self)
28
- x * y
29
- end
30
- end
31
-
32
- def self.create(x)
33
- if self===x
34
- x
35
- else
36
- new(x)
37
- end
38
- end
39
- end
40
- end
41
- end
42
- end
43
- end
@@ -1,31 +0,0 @@
1
- module Toji
2
- module Recipe
3
- module Ingredient
4
- module Rice
5
- module ExpectedSteamable
6
- def soaking_water
7
- @raw * @soaked_rate
8
- end
9
-
10
- def soaked
11
- @raw + @raw * @soaked_rate
12
- end
13
-
14
- def steaming_water
15
- if @before_steaming_rate
16
- @raw * (@before_steaming_rate - @soaked_rate)
17
- end
18
- end
19
-
20
- def steamed
21
- @raw + @raw * @steamed_rate
22
- end
23
-
24
- def cooled
25
- @raw + @raw * @cooled_rate
26
- end
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,21 +0,0 @@
1
- module Toji
2
- module Recipe
3
- module Ingredient
4
- class Yeast
5
-
6
- def initialize(total, rate: Recipe::YeastRate::RED_STAR)
7
- @total = total
8
- @rate = rate
9
- end
10
-
11
- def yeast
12
- @total * @rate.yeast_rate / 1000.0
13
- end
14
-
15
- def water
16
- yeast * @rate.water_rate
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,10 +0,0 @@
1
- require 'toji/recipe/rice_rate/base'
2
- require 'toji/recipe/rice_rate/cooked'
3
- require 'toji/recipe/rice_rate/steamed'
4
-
5
- module Toji
6
- module Recipe
7
- module RiceRate
8
- end
9
- end
10
- end
@@ -1,21 +0,0 @@
1
- module Toji
2
- module Recipe
3
- module RiceRate
4
- module Base
5
- # 浸漬米吸水率
6
- attr_reader :soaked_rate
7
-
8
- # 蒸し前浸漬米吸水率
9
- # 炊飯の場合は水を追加
10
- # 蒸しの場合は一晩経って蒸発した分を削減
11
- attr_reader :before_steaming_rate
12
-
13
- # 蒸米吸水率
14
- attr_reader :steamed_rate
15
-
16
- # 放冷後蒸米吸水率
17
- attr_reader :cooled_rate
18
- end
19
- end
20
- end
21
- end