toji 2.3.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2b379b857923729bb7cc1d3e9dc901537c7724876d13464da420fca8887ef41
4
- data.tar.gz: 99a62648b6353e647d3d2813b18d12cc7f5feb8111465aa5e9176aff4678d9c3
3
+ metadata.gz: fb5e686c2915d1ed44e16fbe3ce58eb232c7ae5d0710c7c8fbc5c924cc4524f7
4
+ data.tar.gz: ca2702441c730f3586be75b300aa1ec07720a88c02f8be76cf88680000ddc2c5
5
5
  SHA512:
6
- metadata.gz: 49e142c89f5a43181cbe02a3c2f771d999302fa548b672fa000ac278daf6f09e5823d33a20611833d1b4f19a6c2a6dfade767df0cff766ca5248b47054ca10bc
7
- data.tar.gz: 29d1955a3e00c7d78e3cda9f5072dbb7bc63b803cbc28ffb9dc0652eaf33750a63b4bb588e361781d922b912082c6b3438fc2ac3212b306d9fee0cedf83f8278
6
+ metadata.gz: e0b8df9e1c731727b2ef95aed906e04dbc90f584f57d640d1cf509e4ffd4688a73e94e11fd8b24b4b014dba47da6a8f717babe534d2bdb275e171326cb937e13
7
+ data.tar.gz: 2dc73ccb8bf508bcc7bf61e04fd750b001f58466d127c5ac828664bced4ceb009f2bbc85c777dbf7d78a4e34d20d8d4e8961358dc136e132bce6729cc8a3404e
@@ -69,20 +69,6 @@ module Example
69
69
  class Step
70
70
  include Toji::Recipe::Step
71
71
 
72
- def to_h
73
- {
74
- name: name,
75
- kake: kake,
76
- koji: koji,
77
- water: water,
78
- lactic_acid: lactic_acid,
79
- alcohol: alcohol,
80
- yeast: yeast,
81
- koji_interval_days: koji_interval_days,
82
- kake_interval_days: kake_interval_days,
83
- }
84
- end
85
-
86
72
  def self.create(name:, kake: 0, koji: 0, water: 0, lactic_acid: 0, alcohol: 0, yeast: 0, koji_interval_days: 0, kake_interval_days: 0)
87
73
  new.tap {|o|
88
74
  o.name = name
@@ -106,16 +92,6 @@ module Example
106
92
  @steps = []
107
93
  end
108
94
 
109
- #def to_h
110
- # {
111
- # steps: steps.map(&:to_h),
112
- # cumulative_rice_totals: cumulative_rice_totals,
113
- # cumulative_shubo_rates: cumulative_shubo_rates,
114
- # shubo_rate: shubo_rate,
115
- # rice_rates: rice_rates,
116
- # }
117
- #end
118
-
119
95
  def self.create(steps)
120
96
  new.tap {|o|
121
97
  o.steps = steps
@@ -282,21 +258,6 @@ module Example
282
258
  @color = color
283
259
  end
284
260
 
285
- def to_h
286
- {
287
- id: id,
288
- name: name,
289
- description: @description,
290
- recipe: @recipe.table_data,
291
- start_date: @start_date,
292
- koji_dates: koji_dates,
293
- kake_dates: kake_dates,
294
- events: events.map(&:to_h),
295
- events_group: events_group,
296
- color: @color,
297
- }
298
- end
299
-
300
261
  def self.create(args)
301
262
  if self===args
302
263
  args
@@ -3,7 +3,7 @@ require_relative 'example_core'
3
3
  require 'terminal-table'
4
4
 
5
5
 
6
- moromi = Toji::Brew::Moromi.load_yaml_file(File.dirname(__FILE__)+"/moromi.yaml")
6
+ moromi = Example::Brew::Moromi.load_yaml_file(File.dirname(__FILE__)+"/moromi.yaml")
7
7
 
8
8
  table = Terminal::Table.new do |t|
9
9
  t << ["作業", "日数", "品温(度)", "操作室温", "ボーメ及び日本酒度", "アルコール度数", "BMD", "アルコール期待値(16.5 +3)", "経過時間", "日時"]
@@ -2,30 +2,37 @@ require 'toji'
2
2
  require_relative 'example_core'
3
3
  require 'terminal-table'
4
4
 
5
- recipe = Example::Recipe::TEMPLATES[:sokujo_nada].scale(900)
5
+ recipe = Example::Recipe::TEMPLATES[:sokujo_nada].scale(900).round(2)
6
6
  step_names = recipe.steps.map(&:name)
7
7
 
8
8
  table = Terminal::Table.new do |t|
9
9
  t << [""] + step_names
10
10
  t << :separator
11
11
  t << ["[原料]"]
12
- t << ["酵母(g or 本)"] + recipe.steps.map(&:yeast).map{|v| v&.round(2)}
13
- t << ["乳酸(ml)"] + recipe.steps.map(&:lactic_acid).map{|v| v&.round(6)}
14
- t << ["掛米(g)"] + recipe.steps.map(&:kake).map{|v| v&.round(2)}
15
- t << ["麹米(g)"] + recipe.steps.map(&:koji).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)}
12
+ t << ["酵母(g or 本)"] + recipe.steps.map(&:yeast)
13
+ t << ["乳酸(ml)"] + recipe.steps.map(&:lactic_acid)
14
+ t << ["掛米(g)"] + recipe.steps.map(&:kake)
15
+ t << ["麹米(g)"] + recipe.steps.map(&:koji)
16
+ t << ["汲水(ml)"] + recipe.steps.map(&:water)
17
+ t << ["醸造アルコール(ml)"] + recipe.steps.map(&:alcohol)
18
18
  t << :separator
19
19
  t << ["[合計]"]
20
- t << ["総米(g)"] + recipe.steps.map(&:rice_total).map{|v| v&.round(2)}
20
+ t << ["総米(g)"] + recipe.steps.map(&:rice_total)
21
21
  t << ["麹歩合(%)"] + recipe.steps.map{|s| s.koji_rate * 100}.map{|v| v&.round(2)}
22
22
  t << ["汲水歩合(%)"] + recipe.steps.map{|s| s.water_rate * 100}.map{|v| v&.round(2)}
23
23
  t << :separator
24
24
  t << ["[累計]"]
25
- t << ["総米(g)"] + recipe.cumulative_rice_totals.map{|v| v&.round(2)}
25
+ t << ["総米(g)"] + recipe.cumulative_rice_totals
26
26
  t << ["白米比率"] + recipe.rice_rates.map{|v| v&.round(2)}
27
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)}
28
+ t << ["タンク内容量(ml)"] + recipe.steps.map {|s|
29
+ kake = Toji::Ingredient::Kake::Expected.create(s.kake)
30
+ koji = Toji::Ingredient::Koji::Expected.create(s.koji)
31
+ s.yeast.to_f + s.lactic_acid.to_f + kake.steamed.to_f + koji.dekoji.to_f + s.water.to_f + s.alcohol.to_f
32
+ }.then {|a|
33
+ sum = 0.0
34
+ a.map {|x| sum += x}
35
+ }.map{|v| v&.round(2)}
29
36
  end
30
37
  puts table
31
38
  puts
@@ -104,33 +104,6 @@ module Toji
104
104
  target_alc - (_baume - target_nihonshudo * -0.1) * coef
105
105
  end
106
106
  end
107
-
108
- def to_h
109
- {
110
- elapsed_time: elapsed_time,
111
- time: time,
112
- mark: mark,
113
- temps: temps,
114
- preset_temp: preset_temp,
115
- room_temp: room_temp,
116
- room_psychrometry: room_psychrometry,
117
- acid: acid,
118
- amino_acid: amino_acid,
119
- alcohol: alcohol,
120
- warmings: warmings,
121
- note: note,
122
-
123
- day: day,
124
- day_label: day_label,
125
- elapsed_time_with_offset: elapsed_time_with_offset,
126
- baume: baume,
127
- nihonshudo: nihonshudo,
128
- display_baume: display_baume,
129
- display_time: display_time,
130
- moromi_day: moromi_day,
131
- bmd: bmd,
132
- }
133
- end
134
107
  end
135
108
  end
136
109
  end
@@ -10,7 +10,7 @@ module Toji
10
10
  end
11
11
 
12
12
  def <<(product)
13
- @products << product
13
+ @products += [product].flatten
14
14
  self
15
15
  end
16
16
  alias_method :add, :<<
@@ -39,16 +39,6 @@ module Toji
39
39
  def weight
40
40
  @product.recipe.steps[@index].send(@type)
41
41
  end
42
-
43
- def to_h
44
- {
45
- date: date,
46
- type: type,
47
- index: index,
48
- group_index: group_index,
49
- weight: weight,
50
- }
51
- end
52
42
  end
53
43
  end
54
44
  end
@@ -22,7 +22,8 @@ module Toji
22
22
  # なお、留め仕込みまでの麹歩合が20%を下回ると蒸米の溶解糖化に影響が出るので注意がいる
23
23
  # 出典: 酒造教本 P95
24
24
  def koji_rate
25
- koji.to_f / rice_total
25
+ val = koji.to_f / rice_total
26
+ val.nan? ? 0.0 : val
26
27
  end
27
28
 
28
29
  # 汲水歩合
@@ -35,7 +36,8 @@ module Toji
35
36
  #
36
37
  # 出典: 酒造教本 P96
37
38
  def water_rate
38
- water.to_f / rice_total
39
+ val = water.to_f / rice_total
40
+ val.nan? ? 0.0 : val
39
41
  end
40
42
 
41
43
  def round(ndigit=0, mini_ndigit=nil, half: :up)
@@ -1,3 +1,3 @@
1
1
  module Toji
2
- VERSION = "2.3.1"
2
+ VERSION = "2.4.0"
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.3.1
4
+ version: 2.4.0
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-22 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