toji 2.13.1 → 2.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/example/example_core.rb +224 -39
  3. data/lib/toji/calendar.rb +2 -2
  4. data/lib/toji/calendar/date_row.rb +2 -2
  5. data/lib/toji/ingredient/alcohol.rb +1 -1
  6. data/lib/toji/ingredient/base.rb +3 -2
  7. data/lib/toji/ingredient/koji.rb +2 -2
  8. data/lib/toji/ingredient/lactic_acid.rb +1 -1
  9. data/lib/toji/ingredient/rice.rb +10 -9
  10. data/lib/toji/ingredient/tanekoji.rb +3 -3
  11. data/lib/toji/ingredient/water.rb +3 -3
  12. data/lib/toji/ingredient/yeast.rb +4 -3
  13. data/lib/toji/processing/base.rb +1 -1
  14. data/lib/toji/processing/cooled_rice.rb +2 -2
  15. data/lib/toji/processing/cooled_rice_element.rb +1 -1
  16. data/lib/toji/processing/dekoji.rb +2 -2
  17. data/lib/toji/processing/dekoji_element.rb +1 -1
  18. data/lib/toji/processing/koji_processing.rb +1 -1
  19. data/lib/toji/processing/rice_processing.rb +4 -4
  20. data/lib/toji/processing/soaked_rice.rb +7 -7
  21. data/lib/toji/processing/soaked_rice_element.rb +3 -3
  22. data/lib/toji/processing/steamed_rice.rb +2 -2
  23. data/lib/toji/processing/steamed_rice_element.rb +1 -1
  24. data/lib/toji/product.rb +9 -15
  25. data/lib/toji/product/schedule_factory.rb +23 -9
  26. data/lib/toji/progress/base_state.rb +2 -5
  27. data/lib/toji/progress/graph/ab.rb +2 -2
  28. data/lib/toji/progress/koji_state.rb +5 -5
  29. data/lib/toji/progress/moromi_progress.rb +1 -1
  30. data/lib/toji/progress/moromi_state.rb +11 -11
  31. data/lib/toji/progress/moto_state.rb +8 -8
  32. data/lib/toji/progress/progress.rb +8 -7
  33. data/lib/toji/progress/state.rb +13 -0
  34. data/lib/toji/recipe.rb +5 -5
  35. data/lib/toji/recipe/ab_expect.rb +2 -2
  36. data/lib/toji/recipe/action.rb +2 -2
  37. data/lib/toji/recipe/step.rb +15 -6
  38. data/lib/toji/schedule/action_schedule.rb +1 -1
  39. data/lib/toji/schedule/base.rb +3 -3
  40. data/lib/toji/schedule/rice_schedule.rb +3 -3
  41. data/lib/toji/version.rb +1 -1
  42. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3518ae786928b8b08256616f1b86f9f00b51fe7a41150a628b195aa3b8e43e2f
4
- data.tar.gz: b6c34cfccdfb72cad06e8206b29cbf7d451b62f060084aaeb92e4c4d6ea81792
3
+ metadata.gz: b23be7a53efdbae7c439914868bcb41c222c062019fecde2e5471cb0e9051e48
4
+ data.tar.gz: 8c9a20caf415f8c6a67d21cb9d52129352fcca1a0899e54e8070d1f8fe0ec54d
5
5
  SHA512:
6
- metadata.gz: ae0f6e5cc017e3f60df94d680c6cea7f4b1a529ab7c99ebd731dc9de409406f5a9b5d7974525a110c67c447dcfccb474ca388849154825fd17c4b7d7cc03637b
7
- data.tar.gz: ae9a15847daf96541a4c081c121befc603dd9df0e7b5ae268915ddeb52442370a99cc8208cf607d1e998cc4e9e93f78dc8a9d2b9351f601a03806fad4038672b
6
+ metadata.gz: d185b9e06e1f4498e21f57cb0e95f93a4be19b6f35230f1673a7c75ffa145948b405df1702f02b64cddff8c5a0a62d4488f536fd06413c9e3be75912d238d858
7
+ data.tar.gz: 67b56cda1946dd6619707f3c899fe20396b50394b5869c2110b282f2c0c61691d37e78b2d4d4b0e9f8b213317fccf29d82d4b234c9a45ca28025433ff16fdc7f
@@ -8,8 +8,12 @@ module Example
8
8
  include Toji::Product
9
9
  include Toji::Product::ScheduleFactory
10
10
 
11
- attr_accessor :description
12
- attr_accessor :color
11
+ attr_reader :name
12
+ attr_reader :recipe
13
+ attr_reader :base_date
14
+
15
+ attr_reader :description
16
+ attr_reader :color
13
17
 
14
18
  def initialize(id, name, description, recipe, base_date, color=nil)
15
19
  @id = id
@@ -86,7 +90,18 @@ module Example
86
90
  class Step
87
91
  include Toji::Recipe::Step
88
92
 
89
- def initialize(kojis: [], kakes: [], waters: [], lactic_acids: [], alcohols: [], yeasts: [])
93
+ attr_reader :index
94
+ attr_reader :subindex
95
+ attr_accessor :kojis
96
+ attr_accessor :kakes
97
+ attr_accessor :waters
98
+ attr_accessor :lactic_acids
99
+ attr_accessor :alcohols
100
+ attr_accessor :yeasts
101
+
102
+ def initialize(index:, subindex:, kojis: [], kakes: [], waters: [], lactic_acids: [], alcohols: [], yeasts: [])
103
+ @index = index
104
+ @subindex = subindex
90
105
  @kojis = kojis
91
106
  @kakes = kakes
92
107
  @waters = waters
@@ -108,6 +123,18 @@ module Example
108
123
  class Koji
109
124
  include Toji::Ingredient::Koji
110
125
 
126
+ attr_accessor :weight
127
+ attr_reader :brand
128
+ attr_reader :polishing_ratio
129
+ attr_reader :made_in
130
+ attr_reader :year
131
+ attr_reader :soaking_ratio
132
+ attr_reader :steaming_ratio
133
+ attr_reader :cooling_ratio
134
+ attr_reader :tanekojis
135
+ attr_reader :dekoji_ratio
136
+ attr_reader :interval_days
137
+
111
138
  def initialize(weight:, brand:, polishing_ratio:, made_in:, year:, soaking_ratio:, steaming_ratio:, cooling_ratio:, tanekojis:, dekoji_ratio:, interval_days:)
112
139
  @weight = weight
113
140
  @brand = brand
@@ -150,6 +177,8 @@ module Example
150
177
  include Toji::Ingredient::Tanekoji
151
178
 
152
179
  attr_accessor :koji
180
+ attr_reader :brand
181
+ attr_reader :ratio
153
182
 
154
183
  def initialize(koji: nil, brand:, ratio:)
155
184
  @brand = brand
@@ -165,6 +194,16 @@ module Example
165
194
  class Kake
166
195
  include Toji::Ingredient::Kake
167
196
 
197
+ attr_accessor :weight
198
+ attr_reader :brand
199
+ attr_reader :polishing_ratio
200
+ attr_reader :made_in
201
+ attr_reader :year
202
+ attr_reader :soaking_ratio
203
+ attr_reader :steaming_ratio
204
+ attr_reader :cooling_ratio
205
+ attr_reader :interval_days
206
+
168
207
  def initialize(weight:, brand:, polishing_ratio:, made_in:, year:, soaking_ratio:, steaming_ratio:, cooling_ratio:, interval_days:)
169
208
  @weight = weight
170
209
  @brand = brand
@@ -181,6 +220,10 @@ module Example
181
220
  class Water
182
221
  include Toji::Ingredient::Water
183
222
 
223
+ attr_accessor :weight
224
+ attr_reader :calcium_hardness
225
+ attr_reader :magnesium_hardness
226
+
184
227
  def initialize(weight:)
185
228
  @weight = weight
186
229
  end
@@ -189,6 +232,8 @@ module Example
189
232
  class LacticAcid
190
233
  include Toji::Ingredient::LacticAcid
191
234
 
235
+ attr_accessor :weight
236
+
192
237
  def initialize(weight:)
193
238
  @weight = weight
194
239
  end
@@ -197,6 +242,8 @@ module Example
197
242
  class Alcohol
198
243
  include Toji::Ingredient::Alcohol
199
244
 
245
+ attr_accessor :weight
246
+
200
247
  def initialize(weight:)
201
248
  @weight = weight
202
249
  end
@@ -205,6 +252,10 @@ module Example
205
252
  class Yeast
206
253
  include Toji::Ingredient::Yeast
207
254
 
255
+ attr_accessor :weight
256
+ attr_reader :unit
257
+ attr_reader :brand
258
+
208
259
  def initialize(weight:)
209
260
  @weight = weight
210
261
  end
@@ -214,22 +265,48 @@ module Example
214
265
  class Action
215
266
  include Toji::Recipe::Action
216
267
 
268
+ attr_reader :type
269
+ attr_reader :interval_days
270
+
217
271
  def initialize(type:, interval_days:)
218
272
  @type = type
219
273
  @interval_days = interval_days
220
274
  end
221
275
  end
222
276
 
277
+ class AbExpect
278
+ include Toji::Recipe::AbExpect
279
+
280
+ attr_reader :alcohol
281
+ attr_reader :nihonshudo
282
+
283
+ def initialize(alcohol:, nihonshudo:)
284
+ @alcohol = alcohol
285
+ @nihonshudo = nihonshudo
286
+ end
287
+ end
288
+
223
289
 
224
290
  class Recipe
225
291
  include Toji::Recipe
226
292
 
227
- def initialize(steps)
293
+ attr_reader :steps
294
+ attr_reader :actions
295
+ attr_reader :ab_coef
296
+ attr_reader :ab_expects
297
+
298
+ def initialize(steps:, actions:, ab_coef:, ab_expects:)
228
299
  @steps = steps
300
+ @actions = actions
301
+ @ab_coef = ab_coef
302
+ @ab_expects = ab_expects
229
303
  end
230
304
 
231
305
  def initialize_copy(obj)
232
306
  @steps = obj.steps.deep_dup
307
+ @actions = obj.actions.deep_dup
308
+ @ab_coef = obj.ab_coef.dup
309
+ @ab_expects = obj.ab_expects.deep_dup
233
310
  end
234
311
 
235
312
  # 乳酸は汲水100L当たり比重1.21の乳酸(90%乳酸と称される)を650〜720ml添加する。
@@ -242,8 +319,10 @@ module Example
242
319
  # 酒造教本による標準型仕込配合
243
320
  # 出典: 酒造教本 P97
244
321
  sokujo_textbook: new(
245
- [
322
+ steps: [
246
323
  Step.new(
324
+ index: 0,
325
+ subindex: 0,
247
326
  kojis: [
248
327
  Koji.new(
249
328
  weight: 20,
@@ -294,6 +373,8 @@ module Example
294
373
  ]
295
374
  ),
296
375
  Step.new(
376
+ index: 1,
377
+ subindex: 0,
297
378
  kojis: [
298
379
  Koji.new(
299
380
  weight: 40,
@@ -334,6 +415,8 @@ module Example
334
415
  ],
335
416
  ),
336
417
  Step.new(
418
+ index: 2,
419
+ subindex: 0,
337
420
  kojis: [
338
421
  Koji.new(
339
422
  weight: 60,
@@ -374,6 +457,8 @@ module Example
374
457
  ],
375
458
  ),
376
459
  Step.new(
460
+ index: 3,
461
+ subindex: 0,
377
462
  kojis: [
378
463
  Koji.new(
379
464
  weight: 80,
@@ -414,6 +499,8 @@ module Example
414
499
  ],
415
500
  ),
416
501
  Step.new(
502
+ index: 4,
503
+ subindex: 0,
417
504
  kakes: [
418
505
  Kake.new(
419
506
  weight: 80,
@@ -433,13 +520,32 @@ module Example
433
520
  ),
434
521
  ],
435
522
  ),
436
- ].map(&:freeze).freeze
523
+ ].map(&:freeze).freeze,
524
+ actions: [
525
+ Action.new(
526
+ type: :squeeze,
527
+ interval_days: 50,
528
+ ),
529
+ ].map(&:freeze).freeze,
530
+ ab_coef: 1.4,
531
+ ab_expects: [
532
+ AbExpect.new(
533
+ alcohol: 15.0,
534
+ nihonshudo: 0.0,
535
+ ),
536
+ AbExpect.new(
537
+ alcohol: 16.0,
538
+ nihonshudo: 3.0,
539
+ ),
540
+ ].map(&:freeze).freeze,
437
541
  ).freeze,
438
542
  # 灘における仕込配合の平均値
439
543
  # 出典: http://www.nada-ken.com/main/jp/index_shi/234.html
440
544
  sokujo_nada: new(
441
- [
545
+ steps: [
442
546
  Step.new(
547
+ index: 0,
548
+ subindex: 0,
443
549
  kojis: [
444
550
  Koji.new(
445
551
  weight: 47,
@@ -490,6 +596,8 @@ module Example
490
596
  ],
491
597
  ),
492
598
  Step.new(
599
+ index: 1,
600
+ subindex: 0,
493
601
  kojis: [
494
602
  Koji.new(
495
603
  weight: 99,
@@ -530,6 +638,8 @@ module Example
530
638
  ],
531
639
  ),
532
640
  Step.new(
641
+ index: 2,
642
+ subindex: 0,
533
643
  kojis: [
534
644
  Koji.new(
535
645
  weight: 143,
@@ -570,6 +680,8 @@ module Example
570
680
  ],
571
681
  ),
572
682
  Step.new(
683
+ index: 3,
684
+ subindex: 0,
573
685
  kojis: [
574
686
  Koji.new(
575
687
  weight: 165,
@@ -610,19 +722,40 @@ module Example
610
722
  ],
611
723
  ),
612
724
  Step.new(
725
+ index: 4,
726
+ subindex: 0,
613
727
  alcohols: [
614
728
  Alcohol.new(
615
729
  weight: 900,
616
730
  ),
617
731
  ],
618
732
  ),
619
- ].map(&:freeze).freeze
733
+ ].map(&:freeze).freeze,
734
+ actions: [
735
+ Action.new(
736
+ type: :squeeze,
737
+ interval_days: 50,
738
+ ),
739
+ ].map(&:freeze).freeze,
740
+ ab_coef: 1.4,
741
+ ab_expects: [
742
+ AbExpect.new(
743
+ alcohol: 15.0,
744
+ nihonshudo: 0.0,
745
+ ),
746
+ AbExpect.new(
747
+ alcohol: 16.0,
748
+ nihonshudo: 3.0,
749
+ ),
750
+ ].map(&:freeze).freeze,
620
751
  ).freeze,
621
752
  # 簡易酒母省略仕込
622
753
  # 出典: https://www.jstage.jst.go.jp/article/jbrewsocjapan1915/60/11/60_11_999/_article/-char/ja/
623
754
  simple_sokujo_himeno: new(
624
- [
755
+ steps: [
625
756
  Step.new(
757
+ index: 0,
758
+ subindex: 0,
626
759
  kojis: [
627
760
  Koji.new(
628
761
  weight: 70,
@@ -644,17 +777,6 @@ module Example
644
777
  ),
645
778
  ],
646
779
  kakes: [
647
- Kake.new(
648
- weight: 0,
649
- brand: :yamadanishiki,
650
- polishing_ratio: 0.55,
651
- made_in: :hyogo,
652
- year: 2020,
653
- soaking_ratio: 0.33,
654
- steaming_ratio: 0.41,
655
- cooling_ratio: 0.33,
656
- interval_days: 6,
657
- ),
658
780
  ],
659
781
  waters: [
660
782
  Water.new(
@@ -673,25 +795,9 @@ module Example
673
795
  ],
674
796
  ),
675
797
  Step.new(
798
+ index: 1,
799
+ subindex: 0,
676
800
  kojis: [
677
- Koji.new(
678
- weight: 0,
679
- brand: :yamadanishiki,
680
- polishing_ratio: 0.55,
681
- made_in: :hyogo,
682
- year: 2020,
683
- soaking_ratio: 0.33,
684
- steaming_ratio: 0.41,
685
- cooling_ratio: 0.33,
686
- tanekojis: [
687
- Tanekoji.new(
688
- brand: :byakuya,
689
- ratio: 0.001,
690
- ),
691
- ],
692
- dekoji_ratio: 0.18,
693
- interval_days: 0,
694
- ),
695
801
  ],
696
802
  kakes: [
697
803
  Kake.new(
@@ -713,6 +819,8 @@ module Example
713
819
  ],
714
820
  ),
715
821
  Step.new(
822
+ index: 2,
823
+ subindex: 0,
716
824
  kojis: [
717
825
  Koji.new(
718
826
  weight: 100,
@@ -753,6 +861,8 @@ module Example
753
861
  ],
754
862
  ),
755
863
  Step.new(
864
+ index: 3,
865
+ subindex: 0,
756
866
  kojis: [
757
867
  Koji.new(
758
868
  weight: 110,
@@ -793,13 +903,32 @@ module Example
793
903
  ],
794
904
  ),
795
905
  Step.new(
906
+ index: 4,
907
+ subindex: 0,
796
908
  waters: [
797
909
  Water.new(
798
910
  weight: 255,
799
911
  ),
800
912
  ],
801
913
  ),
802
- ].map(&:freeze).freeze
914
+ ].map(&:freeze).freeze,
915
+ actions: [
916
+ Action.new(
917
+ type: :squeeze,
918
+ interval_days: 50,
919
+ ),
920
+ ].map(&:freeze).freeze,
921
+ ab_coef: 1.4,
922
+ ab_expects: [
923
+ AbExpect.new(
924
+ alcohol: 15.0,
925
+ nihonshudo: 0.0,
926
+ ),
927
+ AbExpect.new(
928
+ alcohol: 16.0,
929
+ nihonshudo: 3.0,
930
+ ),
931
+ ].map(&:freeze).freeze,
803
932
  ).freeze,
804
933
  }.freeze
805
934
  end
@@ -808,6 +937,12 @@ module Example
808
937
  class KojiSchedule
809
938
  include Toji::Schedule::KojiSchedule
810
939
 
940
+ attr_reader :product
941
+ attr_reader :date
942
+
943
+ attr_reader :step_indexes
944
+ attr_reader :expect
945
+
811
946
  def initialize(product:, date:, step_indexes:, expect:)
812
947
  @product = product
813
948
  @date = date
@@ -819,6 +954,12 @@ module Example
819
954
  class KakeSchedule
820
955
  include Toji::Schedule::KakeSchedule
821
956
 
957
+ attr_reader :product
958
+ attr_reader :date
959
+
960
+ attr_reader :step_indexes
961
+ attr_reader :expect
962
+
822
963
  def initialize(product:, date:, step_indexes:, expect:)
823
964
  @product = product
824
965
  @date = date
@@ -830,6 +971,12 @@ module Example
830
971
  class ActionSchedule
831
972
  include Toji::Schedule::ActionSchedule
832
973
 
974
+ attr_reader :product
975
+ attr_reader :date
976
+ attr_reader :type
977
+
978
+ attr_reader :index_index
979
+
833
980
  def initialize(product:, date:, type:, action_index:)
834
981
  @product = product
835
982
  @date = date
@@ -872,6 +1019,16 @@ module Example
872
1019
  class KojiState
873
1020
  include Toji::Progress::KojiState
874
1021
 
1022
+ attr_accessor :progress
1023
+ attr_accessor :time
1024
+ attr_accessor :mark
1025
+
1026
+ attr_accessor :temps
1027
+ attr_accessor :preset_temp
1028
+ attr_accessor :room_temp
1029
+ attr_accessor :room_psychrometry
1030
+ attr_accessor :note
1031
+
875
1032
  def self.create(args)
876
1033
  new.tap {|s|
877
1034
  s.progress = args[:progress]
@@ -901,6 +1058,19 @@ module Example
901
1058
  class MotoState
902
1059
  include Toji::Progress::MotoState
903
1060
 
1061
+ attr_accessor :progress
1062
+ attr_accessor :time
1063
+ attr_accessor :mark
1064
+
1065
+ attr_accessor :temps
1066
+ attr_accessor :preset_temp
1067
+ attr_accessor :room_temp
1068
+ attr_accessor :room_psychrometry
1069
+ attr_accessor :baume
1070
+ attr_accessor :acid
1071
+ attr_accessor :warmings
1072
+ attr_accessor :note
1073
+
904
1074
  def self.create(args)
905
1075
  new.tap {|s|
906
1076
  s.progress = args[:progress]
@@ -936,6 +1106,21 @@ module Example
936
1106
  include Toji::Progress::MoromiState
937
1107
  include Toji::Progress::State::BaumeToNihonshudo
938
1108
 
1109
+ attr_accessor :progress
1110
+ attr_accessor :time
1111
+ attr_accessor :mark
1112
+
1113
+ attr_accessor :temps
1114
+ attr_accessor :preset_temp
1115
+ attr_accessor :room_temp
1116
+ attr_accessor :room_psychrometry
1117
+ attr_accessor :baume
1118
+ attr_accessor :acid
1119
+ attr_accessor :amino_acid
1120
+ attr_accessor :alcohol
1121
+ attr_accessor :warmings
1122
+ attr_accessor :note
1123
+
939
1124
  def self.create(args)
940
1125
  new.tap {|s|
941
1126
  s.progress = args[:progress]