toji 1.6.8 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/example/calendar.ipynb +123 -0
  3. data/example/{schedule.yaml → calendar.yaml} +6 -30
  4. data/example/calendar_file.ipynb +338 -0
  5. data/example/example_core.rb +336 -0
  6. data/example/kake_recipe.rb +27 -0
  7. data/example/koji_making.ipynb +16 -15
  8. data/example/koji_making.rb +2 -1
  9. data/example/koji_making.yaml +9 -9
  10. data/example/koji_making_multi.ipynb +26 -25
  11. data/example/koji_recipe.rb +1 -1
  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 +10 -10
  19. data/lib/toji.rb +3 -1
  20. data/lib/toji/brew.rb +1 -2
  21. data/lib/toji/brew/base.rb +7 -71
  22. data/lib/toji/brew/builder.rb +47 -4
  23. data/lib/toji/brew/graph/bmd.rb +0 -1
  24. data/lib/toji/brew/graph/progress.rb +1 -1
  25. data/lib/toji/brew/koji.rb +0 -10
  26. data/lib/toji/brew/moromi.rb +2 -36
  27. data/lib/toji/brew/shubo.rb +0 -5
  28. data/lib/toji/brew/state.rb +58 -111
  29. data/lib/toji/brew/state_wrapper.rb +135 -0
  30. data/lib/toji/calendar.rb +123 -0
  31. data/lib/toji/{schedule → calendar}/date_column.rb +3 -6
  32. data/lib/toji/{schedule → calendar}/date_row.rb +6 -6
  33. data/lib/toji/ingredient.rb +10 -0
  34. data/lib/toji/ingredient/kake.rb +17 -0
  35. data/lib/toji/ingredient/kake/actual.rb +27 -0
  36. data/lib/toji/ingredient/kake/base.rb +18 -0
  37. data/lib/toji/ingredient/kake/expected.rb +41 -0
  38. data/lib/toji/ingredient/koji.rb +19 -0
  39. data/lib/toji/ingredient/koji/actual.rb +30 -0
  40. data/lib/toji/ingredient/koji/actual_fermentable.rb +15 -0
  41. data/lib/toji/ingredient/koji/base.rb +35 -0
  42. data/lib/toji/ingredient/koji/expected.rb +46 -0
  43. data/lib/toji/ingredient/koji/expected_fermentable.rb +15 -0
  44. data/lib/toji/{recipe → ingredient}/koji_rate.rb +1 -1
  45. data/lib/toji/ingredient/rice.rb +10 -0
  46. data/lib/toji/ingredient/rice/actual_steamable.rb +27 -0
  47. data/lib/toji/ingredient/rice/base.rb +41 -0
  48. data/lib/toji/ingredient/rice/expected_steamable.rb +29 -0
  49. data/lib/toji/ingredient/rice_rate.rb +35 -0
  50. data/lib/toji/product.rb +65 -0
  51. data/lib/toji/{schedule/product_event.rb → product/event.rb} +4 -4
  52. data/lib/toji/recipe.rb +120 -5
  53. data/lib/toji/recipe/step.rb +46 -59
  54. data/lib/toji/version.rb +1 -1
  55. metadata +32 -38
  56. data/example/rice_recipe.rb +0 -28
  57. data/example/schedule.ipynb +0 -393
  58. data/example/schedule_file.ipynb +0 -337
  59. data/example/three_step_mashing_recipe.rb +0 -67
  60. data/lib/toji/brew/state_accessor.rb +0 -13
  61. data/lib/toji/brew/state_record.rb +0 -72
  62. data/lib/toji/recipe/ingredient.rb +0 -10
  63. data/lib/toji/recipe/ingredient/koji.rb +0 -21
  64. data/lib/toji/recipe/ingredient/koji/actual.rb +0 -32
  65. data/lib/toji/recipe/ingredient/koji/actual_fermentable.rb +0 -17
  66. data/lib/toji/recipe/ingredient/koji/base.rb +0 -37
  67. data/lib/toji/recipe/ingredient/koji/expected.rb +0 -48
  68. data/lib/toji/recipe/ingredient/koji/expected_fermentable.rb +0 -17
  69. data/lib/toji/recipe/ingredient/rice.rb +0 -21
  70. data/lib/toji/recipe/ingredient/rice/actual.rb +0 -29
  71. data/lib/toji/recipe/ingredient/rice/actual_steamable.rb +0 -29
  72. data/lib/toji/recipe/ingredient/rice/base.rb +0 -51
  73. data/lib/toji/recipe/ingredient/rice/expected.rb +0 -43
  74. data/lib/toji/recipe/ingredient/rice/expected_steamable.rb +0 -31
  75. data/lib/toji/recipe/ingredient/yeast.rb +0 -21
  76. data/lib/toji/recipe/rice_rate.rb +0 -10
  77. data/lib/toji/recipe/rice_rate/base.rb +0 -21
  78. data/lib/toji/recipe/rice_rate/cooked.rb +0 -67
  79. data/lib/toji/recipe/rice_rate/steamed.rb +0 -30
  80. data/lib/toji/recipe/three_step_mashing.rb +0 -274
  81. data/lib/toji/recipe/yeast_rate.rb +0 -41
  82. data/lib/toji/schedule.rb +0 -11
  83. data/lib/toji/schedule/calendar.rb +0 -139
  84. data/lib/toji/schedule/date_interval_enumerator.rb +0 -45
  85. data/lib/toji/schedule/product.rb +0 -117
@@ -1,67 +0,0 @@
1
- require 'toji'
2
- require 'terminal-table'
3
-
4
- recipe = Toji::Recipe::ThreeStepMashing::TEMPLATES[:sokujo_nada].scale(900)
5
- step_names = recipe.steps.map(&:name)
6
-
7
- table = Terminal::Table.new do |t|
8
- t << [""] + step_names
9
- t << :separator
10
- t << ["[原料]"]
11
- t << ["酵母(g)", recipe.yeast.yeast&.round(2)]
12
- t << ["酵母吸水", recipe.yeast.water&.round(2)]
13
- t << ["乳酸(ml)"] + recipe.steps.map(&:lactic_acid).map{|v| v&.round(6)}
14
- t << ["掛米(g)"] + recipe.steps.map(&:rice).map(&:raw).map{|v| v&.round(2)}
15
- t << ["麹米(g)"] + recipe.steps.map(&:koji).map(&:raw).map{|v| v&.round(2)}
16
- t << ["汲水(ml)"] + recipe.steps.map(&:water).map{|v| v&.round(2)}
17
- t << ["醸造アルコール(ml)"] + recipe.steps.map(&:alcohol).map{|v| v&.round(2)}
18
- t << :separator
19
- t << ["[合計]"]
20
- t << ["総米(g)"] + recipe.steps.map(&:rice_total).map{|v| v&.round(2)}
21
- t << ["麹歩合(%)"] + recipe.steps.map{|s| s.koji_rate * 100}.map{|v| v&.round(2)}
22
- t << ["汲水歩合(%)"] + recipe.steps.map{|s| s.water_rate * 100}.map{|v| v&.round(2)}
23
- t << :separator
24
- t << ["[累計]"]
25
- t << ["総米(g)"] + recipe.cumulative_rice_totals.map{|v| v&.round(2)}
26
- t << ["白米比率"] + recipe.rice_rates.map{|v| v&.round(2)}
27
- t << ["酒母歩合(%)"] + recipe.cumulative_shubo_rates.map{|s| s * 100}.map{|v| v&.round(2)}
28
- t << ["タンク内容量(ml)"] + recipe.cumulative_weight_totals.map{|v| v&.round(2)}
29
- end
30
- puts table
31
- puts
32
-
33
-
34
- puts "掛米"
35
- table = Terminal::Table.new do |t|
36
- t << ["工程", "原料"] + step_names
37
- t << :separator
38
- t << ["洗米・浸漬", "白米(g)"] + recipe.steps.map(&:rice).map(&:raw).map{|v| v&.round(2)}
39
- t << ["", "吸水増加量(ml)"] + recipe.steps.map(&:rice).map(&:soaking_water).map{|v| v&.round(2)}
40
- t << :separator
41
- t << ["水切り", "浸漬米(g)"] + recipe.steps.map(&:rice).map(&:soaked).map{|v| v&.round(2)}
42
- t << ["", "汲水(ml)"] + recipe.steps.map(&:rice).map(&:steaming_water).map{|v| v&.round(2)}
43
- t << :separator
44
- t << ["蒸し", "蒸米(g)"] + recipe.steps.map(&:rice).map(&:steamed).map{|v| v&.round(2)}
45
- end
46
- puts table
47
- puts
48
-
49
- puts "麹"
50
- table = Terminal::Table.new do |t|
51
- t << ["工程", "原料"] + step_names
52
- t << :separator
53
- t << ["洗米・浸漬", "白米(g)"] + recipe.steps.map(&:koji).map(&:raw).map{|v| v&.round(2)}
54
- t << ["", "吸水増加量(ml)"] + recipe.steps.map(&:koji).map(&:soaking_water).map{|v| v&.round(2)}
55
- t << :separator
56
- t << ["水切り", "浸漬米(g)"] + recipe.steps.map(&:koji).map(&:soaked).map{|v| v&.round(2)}
57
- t << ["", "汲水(ml)"] + recipe.steps.map(&:koji).map(&:steaming_water).map{|v| v&.round(2)}
58
- t << :separator
59
- t << ["蒸し", "蒸米(g)"] + recipe.steps.map(&:koji).map(&:steamed).map{|v| v&.round(2)}
60
- t << :separator
61
- t << ["放冷・引込み", "蒸米(g)"] + recipe.steps.map(&:koji).map(&:cooled).map{|v| v&.round(2)}
62
- t << ["", "種麹(g)"] + recipe.steps.map(&:koji).map(&:tanekoji).map{|v| v&.round(2)}
63
- t << :separator
64
- t << ["製麹", "麹(g)"] + recipe.steps.map(&:koji).map(&:dekoji).map{|v| v&.round(2)}
65
- end
66
- puts table
67
- puts
@@ -1,13 +0,0 @@
1
- module Toji
2
- module Brew
3
- module StateAccessor
4
- def state_reader(*args)
5
- args.each {|arg|
6
- define_method(arg) {
7
- @data[arg]
8
- }
9
- }
10
- end
11
- end
12
- end
13
- end
@@ -1,72 +0,0 @@
1
- module Toji
2
- module Brew
3
- class StateRecord
4
- KEYS = [
5
- :time,
6
- :elapsed_time,
7
- :mark,
8
- :temps,
9
- :preset_temp,
10
- :room_temp,
11
- :room_psychrometry,
12
- :baume,
13
- :nihonshudo,
14
- :acid,
15
- :amino_acid,
16
- :alcohol,
17
- :warmings,
18
- :note,
19
- ].freeze
20
-
21
- attr_accessor :time
22
- attr_accessor :elapsed_time
23
- attr_accessor :mark
24
- attr_accessor :temps
25
-
26
- attr_accessor :preset_temp
27
- attr_accessor :room_temp
28
- attr_accessor :room_psychrometry
29
-
30
- attr_accessor :baume
31
- attr_accessor :nihonshudo
32
- attr_accessor :acid
33
- attr_accessor :amino_acid
34
- attr_accessor :alcohol
35
-
36
- attr_accessor :warmings
37
- attr_accessor :note
38
-
39
- def temps=(val)
40
- @temps = [val].flatten.compact
41
- end
42
-
43
- def time=(val)
44
- @time = val&.to_time
45
- end
46
-
47
- def warmings=(val)
48
- @warmings = [val].flatten.compact
49
- end
50
-
51
- def self.create(r)
52
- if StateRecord===r
53
- r
54
- elsif State==r
55
- r.record
56
- elsif Hash===r
57
- record = new
58
- KEYS.each {|k|
59
- record.send("#{k}=", r[k])
60
- }
61
- record
62
- else
63
- record = new
64
- KEYS.each {|k|
65
- record.send("#{k}=", r.send(k))
66
- }
67
- record
68
- end
69
- end
70
- end
71
- end
72
- end
@@ -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