toji 2.1.1 → 2.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/example/calendar.ipynb +281 -21
  3. data/example/calendar_file.ipynb +37 -37
  4. data/example/example_core.rb +27 -53
  5. data/example/{kake_recipe.rb → kake_ingredient.rb} +0 -1
  6. data/example/{koji_recipe.rb → koji_ingredient.rb} +1 -2
  7. data/example/koji_making.ipynb +9 -9
  8. data/example/koji_making.yaml +1 -0
  9. data/example/koji_making_multi.ipynb +22 -57
  10. data/example/moromi.ipynb +17 -17
  11. data/example/moromi.rb +1 -1
  12. data/example/recipe.rb +17 -10
  13. data/example/shubo.ipynb +12 -12
  14. data/example/shubo.yaml +2 -1
  15. data/lib/toji/brew.rb +4 -2
  16. data/lib/toji/brew/base.rb +6 -26
  17. data/lib/toji/brew/builder.rb +49 -21
  18. data/lib/toji/brew/graph/bmd.rb +1 -1
  19. data/lib/toji/brew/graph/multi_progress.rb +0 -121
  20. data/lib/toji/brew/graph/progress.rb +16 -51
  21. data/lib/toji/brew/koji.rb +2 -1
  22. data/lib/toji/brew/moromi.rb +2 -1
  23. data/lib/toji/brew/shubo.rb +2 -1
  24. data/lib/toji/brew/state.rb +5 -1
  25. data/lib/toji/brew/{state_wrapper.rb → wrapped_state.rb} +6 -32
  26. data/lib/toji/calendar.rb +1 -1
  27. data/lib/toji/ingredient/kake.rb +2 -2
  28. data/lib/toji/ingredient/kake/actual.rb +6 -7
  29. data/lib/toji/ingredient/kake/base.rb +1 -1
  30. data/lib/toji/ingredient/kake/expected.rb +0 -1
  31. data/lib/toji/ingredient/koji.rb +2 -2
  32. data/lib/toji/ingredient/koji/actual.rb +8 -9
  33. data/lib/toji/ingredient/koji/base.rb +1 -1
  34. data/lib/toji/ingredient/koji/expected.rb +0 -1
  35. data/lib/toji/ingredient/rice/actual_steamable.rb +4 -4
  36. data/lib/toji/ingredient/rice/base.rb +0 -1
  37. data/lib/toji/ingredient/rice/expected_steamable.rb +1 -3
  38. data/lib/toji/ingredient/rice_rate.rb +2 -14
  39. data/lib/toji/product/event.rb +0 -10
  40. data/lib/toji/recipe.rb +5 -14
  41. data/lib/toji/recipe/step.rb +33 -33
  42. data/lib/toji/version.rb +1 -1
  43. metadata +5 -5
@@ -13,7 +13,7 @@ module Toji
13
13
 
14
14
  # 総米
15
15
  def rice_total
16
- kake + koji
16
+ kake.to_f + koji.to_f
17
17
  end
18
18
 
19
19
  # 麹歩合
@@ -22,8 +22,8 @@ module Toji
22
22
  # なお、留め仕込みまでの麹歩合が20%を下回ると蒸米の溶解糖化に影響が出るので注意がいる
23
23
  # 出典: 酒造教本 P95
24
24
  def koji_rate
25
- ret = koji / rice_total
26
- ret.nan? ? 0.0 : ret
25
+ val = koji.to_f / rice_total
26
+ val.nan? ? 0.0 : val
27
27
  end
28
28
 
29
29
  # 汲水歩合
@@ -36,40 +36,40 @@ module Toji
36
36
  #
37
37
  # 出典: 酒造教本 P96
38
38
  def water_rate
39
- ret = water / rice_total
40
- ret.nan? ? 0.0 : ret
39
+ val = water.to_f / rice_total
40
+ val.nan? ? 0.0 : val
41
41
  end
42
42
 
43
- def round(ndigit=0, acid_ndigit=nil, half: :up)
44
- if !acid_ndigit
45
- acid_ndigit = ndigit + 3
43
+ def round(ndigit=0, mini_ndigit=nil, half: :up)
44
+ if !mini_ndigit
45
+ mini_ndigit = ndigit + 3
46
46
  end
47
47
 
48
48
  self.class.new.tap {|o|
49
49
  o.name = name
50
- o.kake = kake.round(ndigit, half: half)
51
- o.koji = koji.round(ndigit, half: half)
52
- o.water = water.round(ndigit, half: half)
53
- o.lactic_acid = lactic_acid.round(acid_ndigit, half: half)
54
- o.alcohol = alcohol.round(ndigit, half: half)
55
- o.yeast = yeast.round(ndigit, half: half)
56
- o.koji_interval_days = koji_interval_days
57
- o.kake_interval_days = kake_interval_days
50
+ o.kake = kake.to_f.round(ndigit, half: half)
51
+ o.koji = koji.to_f.round(ndigit, half: half)
52
+ o.water = water.to_f.round(ndigit, half: half)
53
+ o.lactic_acid = lactic_acid.to_f.round(mini_ndigit, half: half)
54
+ o.alcohol = alcohol.to_f.round(ndigit, half: half)
55
+ o.yeast = yeast.to_f.round(mini_ndigit, half: half)
56
+ o.koji_interval_days = koji_interval_days.to_i
57
+ o.kake_interval_days = kake_interval_days.to_i
58
58
  }
59
59
  end
60
60
 
61
61
  def +(other)
62
62
  if Step===other
63
63
  self.class.new.tap {|o|
64
- o.name = nil
65
- o.kake = kake + other.kake
66
- o.koji = koji + other.koji
67
- o.water = water + other.water
68
- o.lactic_acid = lactic_acid + other.lactic_acid
69
- o.alcohol = alcohol + other.alcohol
70
- o.yeast = yeast + other.yeast
71
- o.koji_interval_days = koji_interval_days
72
- o.kake_interval_days = kake_interval_days
64
+ o.name = name
65
+ o.kake = kake.to_f + other.kake.to_f
66
+ o.koji = koji.to_f + other.koji.to_f
67
+ o.water = water.to_f + other.water.to_f
68
+ o.lactic_acid = lactic_acid.to_f + other.lactic_acid.to_f
69
+ o.alcohol = alcohol.to_f + other.alcohol.to_f
70
+ o.yeast = yeast.to_f + other.yeast.to_f
71
+ o.koji_interval_days = koji_interval_days.to_i
72
+ o.kake_interval_days = kake_interval_days.to_i
73
73
  }
74
74
  else
75
75
  x, y = other.coerce(self)
@@ -81,14 +81,14 @@ module Toji
81
81
  if Integer===other || Float===other
82
82
  self.class.new.tap {|o|
83
83
  o.name = name
84
- o.kake = kake * other
85
- o.koji = koji * other
86
- o.water = water * other
87
- o.lactic_acid = lactic_acid * other
88
- o.alcohol = alcohol * other
89
- o.yeast = yeast * other
90
- o.koji_interval_days = koji_interval_days
91
- o.kake_interval_days = kake_interval_days
84
+ o.kake = kake.to_f * other
85
+ o.koji = koji.to_f * other
86
+ o.water = water.to_f * other
87
+ o.lactic_acid = lactic_acid.to_f * other
88
+ o.alcohol = alcohol.to_f * other
89
+ o.yeast = yeast.to_f * other
90
+ o.koji_interval_days = koji_interval_days.to_i
91
+ o.kake_interval_days = kake_interval_days.to_i
92
92
  }
93
93
  else
94
94
  x, y = other.coerce(self)
@@ -1,3 +1,3 @@
1
1
  module Toji
2
- VERSION = "2.1.1"
2
+ VERSION = "2.4.1"
3
3
  end
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.1.1
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshida Tetsuya
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-19 00:00:00.000000000 Z
11
+ date: 2020-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -113,12 +113,12 @@ files:
113
113
  - example/calendar.yaml
114
114
  - example/calendar_file.ipynb
115
115
  - example/example_core.rb
116
- - example/kake_recipe.rb
116
+ - example/kake_ingredient.rb
117
+ - example/koji_ingredient.rb
117
118
  - example/koji_making.ipynb
118
119
  - example/koji_making.rb
119
120
  - example/koji_making.yaml
120
121
  - example/koji_making_multi.ipynb
121
- - example/koji_recipe.rb
122
122
  - example/moromi.ipynb
123
123
  - example/moromi.rb
124
124
  - example/moromi.yaml
@@ -139,7 +139,7 @@ files:
139
139
  - lib/toji/brew/moromi.rb
140
140
  - lib/toji/brew/shubo.rb
141
141
  - lib/toji/brew/state.rb
142
- - lib/toji/brew/state_wrapper.rb
142
+ - lib/toji/brew/wrapped_state.rb
143
143
  - lib/toji/calendar.rb
144
144
  - lib/toji/calendar/date_column.rb
145
145
  - lib/toji/calendar/date_row.rb