toji 2.13.0 → 2.17.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: 790b5fcd43ef2cfa6a3f0d16618651be488cdd42c6814c8e64d6f9565dc95a7f
4
- data.tar.gz: 6783fd2dbf5a242ccc83e375a9e1c5896c906e25f49055392e64722b60ca67e5
3
+ metadata.gz: bfa76ef9b8f8a73ea20b84bf68c9480a1664888c08fb2d541cdfd6023b4f93a3
4
+ data.tar.gz: ce4f2d927d653d20a541d21a98954d27c70eba6e67022355e8cf9d887ca2842b
5
5
  SHA512:
6
- metadata.gz: e3073e4fae01131c7cbad525a28700d9996e83c9cb999969b61a24ba62bffed95aa72d9999ba3b4f36327678b678f6f04bac38281cd8804aeb73aedfc50b7bbe
7
- data.tar.gz: 2aa7c01abc363d154e809abc3673b0d2a20e4d62342d5ecdb74f1ccb241349ad7d7702be3f9b68b3f7ad2da3506b97aa40c015e4c8fbe82556ed6dad0b6443d1
6
+ metadata.gz: 134dfc5763d67f9dda33917ad51dfb923631e503e296ab97eea6733fb809b656d73d702263a6a3b565b27a9ac3594d1fd1b3f7599259947098b0a36a7ce86f33
7
+ data.tar.gz: bd02c83d17c87aabfb3f24cc6386d48f7cc562dd61f5d66a75615dae70b93c100779e55772f7a821eae6ad6abc15c6c1e6dfc1ea51ab242ad84efd1459e13096
@@ -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]
@@ -32,8 +32,8 @@ module Toji
32
32
  kake_schedules = @products.map{|product| product.kake_schedules}.flatten
33
33
  schedules = koji_schedules + kake_schedules
34
34
 
35
- koji_len = koji_schedules.map{|schedule| schedule.step_indexes.first}.max + 1
36
- kake_len = kake_schedules.map{|schedule| schedule.step_indexes.first}.max + 1
35
+ koji_len = koji_schedules.map{|schedule| schedule.step_indexes.first[:index]}.max + 1
36
+ kake_len = kake_schedules.map{|schedule| schedule.step_indexes.first[:index]}.max + 1
37
37
  min_date = schedules.map(&:date).min
38
38
  max_date = schedules.map(&:date).max
39
39
 
@@ -14,11 +14,11 @@ module Toji
14
14
  def <<(schedule)
15
15
  case schedule.rice_type
16
16
  when :koji
17
- index = schedule.step_indexes.first
17
+ index = schedule.step_indexes.first[:index]
18
18
  @kojis[index] ||= DateColumn.new
19
19
  @kojis[index] << schedule
20
20
  when :kake
21
- index = schedule.step_indexes.first
21
+ index = schedule.step_indexes.first[:index]
22
22
  @kakes[index] ||= DateColumn.new
23
23
  @kakes[index] << schedule
24
24
  end
@@ -4,7 +4,7 @@ module Toji
4
4
  include Base
5
5
 
6
6
  # 醸造用アルコール
7
- attr_accessor :weight
7
+ # @dynamic weight
8
8
 
9
9
  def group_key
10
10
  ""
@@ -2,10 +2,11 @@ module Toji
2
2
  module Ingredient
3
3
  module Base
4
4
  # 重量
5
- attr_accessor :weight
5
+ # @dynamic weight
6
+ # @dynamic weight=
6
7
 
7
8
  # グループ識別子
8
- attr_reader :group_key
9
+ # @dynamic group_key
9
10
  end
10
11
  end
11
12
  end
@@ -4,14 +4,14 @@ module Toji
4
4
  include Rice
5
5
 
6
6
  # 種麹 (has_many: Toji::Ingredient::Tanekoji)
7
- attr_reader :tanekojis
7
+ # @dynamic tanekojis
8
8
 
9
9
  # 出麹歩合
10
10
  #
11
11
  # 出麹歩合17〜19%のものが麹菌の繁殖のほどよい麹である
12
12
  #
13
13
  # 出典: 酒造教本 P67
14
- attr_reader :dekoji_ratio
14
+ # @dynamic dekoji_ratio
15
15
 
16
16
  def dekoji
17
17
  weight + weight * dekoji_ratio
@@ -4,7 +4,7 @@ module Toji
4
4
  include Base
5
5
 
6
6
  # 乳酸
7
- attr_accessor :weight
7
+ # @dynamic weight
8
8
 
9
9
  def group_key
10
10
  ""
@@ -4,20 +4,21 @@ module Toji
4
4
  include Base
5
5
 
6
6
  # 白米
7
- attr_accessor :weight
7
+ # @dynamic weight
8
+ # @dynamic weight=
8
9
 
9
10
  # 品種、精米歩合、産地、年度
10
- attr_reader :brand
11
- attr_reader :polishing_ratio
12
- attr_reader :made_in
13
- attr_reader :year
11
+ # @dynamic brand
12
+ # @dynamic polishing_ratio
13
+ # @dynamic made_in
14
+ # @dynamic year
14
15
 
15
16
  # 浸漬米吸水率
16
17
  #
17
18
  # 標準的な白米吸水率は掛米で30〜35%、麹米で33%前後で許容範囲はかなり狭い
18
19
  #
19
20
  # 出典: 酒造教本 P38
20
- attr_reader :soaking_ratio
21
+ # @dynamic soaking_ratio
21
22
 
22
23
  def soaked
23
24
  weight + weight * soaking_ratio
@@ -30,7 +31,7 @@ module Toji
30
31
  # 蒸米吸水率は麹米及び酒母米で41〜43%、掛米は39〜40%で、吟醸造りの場合は数%低い
31
32
  #
32
33
  # 出典: 酒造教本 P48
33
- attr_reader :steaming_ratio
34
+ # @dynamic steaming_ratio
34
35
 
35
36
  def steamed
36
37
  weight + weight * steaming_ratio
@@ -43,14 +44,14 @@ module Toji
43
44
  #
44
45
  # 麹を造るのに適した蒸米は、引込時の吸水率が33%を理想とし、許容幅はプラスマイナス1%である
45
46
  # 出典: 酒造教本 P59
46
- attr_reader :cooling_ratio
47
+ # @dynamic cooling_ratio
47
48
 
48
49
  def cooled
49
50
  weight + weight * cooling_ratio
50
51
  end
51
52
 
52
53
  # Product.base_dateからの日数差
53
- attr_reader :interval_days
54
+ # @dynamic interval_days
54
55
  end
55
56
  end
56
57
  end
@@ -4,10 +4,10 @@ module Toji
4
4
  include Base
5
5
 
6
6
  # 麹 (belongs_to: Toji::Ingredient::Koji)
7
- attr_reader :koji
7
+ # @dynamic koji
8
8
 
9
9
  # 種麹の種類
10
- attr_reader :brand
10
+ # @dynamic brand
11
11
 
12
12
  # 種麹
13
13
  #
@@ -15,7 +15,7 @@ module Toji
15
15
  # 突き破精麹を造るには、種麹の量を麹米100kgあたり種麹80gとする
16
16
  #
17
17
  # 出典: 酒造教本 P66
18
- attr_reader :ratio
18
+ # @dynamic ratio
19
19
 
20
20
  def weight
21
21
  koji.weight * ratio
@@ -4,11 +4,11 @@ module Toji
4
4
  include Base
5
5
 
6
6
  # 汲水
7
- attr_accessor :weight
7
+ # @dynamic weight
8
8
 
9
9
  # 硬度
10
- attr_reader :calcium_hardness
11
- attr_reader :magnesium_hardness
10
+ # @dynamic calcium_hardness
11
+ # @dynamic magnesium_hardness
12
12
 
13
13
  def group_key
14
14
  [calcium_hardness, magnesium_hardness].join(":")
@@ -4,13 +4,14 @@ module Toji
4
4
  include Base
5
5
 
6
6
  # 酵母
7
- attr_accessor :weight
7
+ # @dynamic weight
8
+ # @dynamic weight=
8
9
 
9
10
  # 単位 (ex: ampoule, gram, ml)
10
- attr_reader :unit
11
+ # @dynamic unit
11
12
 
12
13
  # 酵母名、協会酵母番号
13
- attr_reader :brand
14
+ # @dynamic brand
14
15
 
15
16
  def group_key
16
17
  [brand, unit].join(":")
@@ -2,20 +2,14 @@ require 'toji/product/schedule_factory'
2
2
 
3
3
  module Toji
4
4
  module Product
5
- attr_reader :name
6
- attr_reader :recipe
7
- attr_reader :base_date
8
-
9
- attr_reader :koji_schedules
10
- attr_reader :kake_schedules
11
- attr_reader :action_schedules
12
-
13
- def rice_schedules
14
- koji_schedules + kake_schedules
15
- end
16
-
17
- def schedules
18
- rice_schedules + action_schedules
19
- end
5
+ # @dynamic name
6
+ # @dynamic recipe
7
+ # @dynamic base_date
8
+
9
+ # @dynamic koji_schedules
10
+ # @dynamic kake_schedules
11
+ # @dynamic action_schedules
12
+ # @dynamic rice_schedules
13
+ # @dynamic schedules
20
14
  end
21
15
  end
@@ -15,10 +15,13 @@ module Toji
15
15
  end
16
16
 
17
17
  def koji_schedules
18
- recipe.steps.each.with_index.inject([]) {|result, (step, i)|
18
+ recipe.steps.inject([]) {|result, step|
19
19
  step.kojis&.each {|koji|
20
20
  result << {
21
- step_index: i,
21
+ step_index: {
22
+ index: step.index,
23
+ subindex: step.subindex,
24
+ },
22
25
  date: base_date.next_day(koji.interval_days),
23
26
  koji: koji,
24
27
  }
@@ -28,20 +31,23 @@ module Toji
28
31
  0<schedule[:koji]&.weight.to_f
29
32
  }.group_by {|schedule|
30
33
  [schedule[:date], schedule[:koji].group_key]
31
- }.map {|(date, group_key), schedules|
34
+ }.map {|(date, _group_key), schedules|
32
35
  create_koji_schedule(
33
36
  date: date,
34
- step_indexes: schedules.map {|schedule| schedule[:step_index]}.sort,
37
+ step_indexes: schedules.map {|schedule| schedule[:step_index]}.sort_by {|x| [x[:index], x[:subindex]]},
35
38
  kojis: schedules.map{|schedule| schedule[:koji]},
36
39
  )
37
40
  }
38
41
  end
39
42
 
40
43
  def kake_schedules
41
- recipe.steps.each.with_index.inject([]) {|result, (step, i)|
44
+ recipe.steps.inject([]) {|result, step|
42
45
  step.kakes&.each {|kake|
43
46
  result << {
44
- step_index: i,
47
+ step_index: {
48
+ index: step.index,
49
+ subindex: step.subindex,
50
+ },
45
51
  date: base_date.next_day(kake.interval_days),
46
52
  kake: kake,
47
53
  }
@@ -50,11 +56,11 @@ module Toji
50
56
  }.select {|schedule|
51
57
  0<schedule[:kake]&.weight.to_f
52
58
  }.group_by {|schedule|
53
- [schedule[:date], schedule[:kake].group_key]
54
- }.map {|(date, group_key), schedules|
59
+ [schedule[:date], schedule[:kake].group_key, schedule[:step_index]]
60
+ }.map {|(date, _group_key, _step_index), schedules|
55
61
  create_kake_schedule(
56
62
  date: date,
57
- step_indexes: schedules.map {|schedule| schedule[:step_index]}.sort,
63
+ step_indexes: schedules.map {|schedule| schedule[:step_index]}.sort_by {|x| [x[:index], x[:subindex]]},
58
64
  kakes: schedules.map{|schedule| schedule[:kake]},
59
65
  )
60
66
  }
@@ -69,6 +75,14 @@ module Toji
69
75
  )
70
76
  }
71
77
  end
78
+
79
+ def rice_schedules
80
+ koji_schedules + kake_schedules
81
+ end
82
+
83
+ def schedules
84
+ rice_schedules + action_schedules
85
+ end
72
86
  end
73
87
  end
74
88
  end
@@ -1,6 +1,8 @@
1
1
  module Toji
2
2
  module Progress
3
3
  module BaseState
4
+ include State
5
+
4
6
  REQUIRED_KEYS = [
5
7
  :time,
6
8
  :elapsed_time,
@@ -10,11 +12,6 @@ module Toji
10
12
  :mark,
11
13
  ].freeze
12
14
 
13
- attr_accessor :progress
14
-
15
- attr_accessor :time
16
- attr_accessor :mark
17
-
18
15
  def elapsed_time
19
16
  time - progress.base_time
20
17
  end
@@ -58,13 +58,13 @@ module Toji
58
58
  def min_baume
59
59
  @actuals.map {|moromi, name|
60
60
  moromi.states.map(&:baume).compact.min
61
- }.compact.min || 0
61
+ }.compact.min || 0.0
62
62
  end
63
63
 
64
64
  def max_baume
65
65
  @actuals.map {|moromi, name|
66
66
  moromi.states.map(&:baume).compact.max
67
- }.compact.max || 0
67
+ }.compact.max || 0.0
68
68
  end
69
69
 
70
70
  def plot
@@ -12,12 +12,12 @@ module Toji
12
12
  :note,
13
13
  ].freeze
14
14
 
15
- attr_accessor :temps
16
- attr_accessor :preset_temp
17
- attr_accessor :room_temp
18
- attr_accessor :room_psychrometry
15
+ # @dynamic temps
16
+ # @dynamic preset_temp
17
+ # @dynamic room_temp
18
+ # @dynamic room_psychrometry
19
19
 
20
- attr_accessor :note
20
+ # @dynamic note
21
21
  end
22
22
  end
23
23
  end
@@ -3,7 +3,7 @@ module Toji
3
3
  module MoromiProgress
4
4
  include BaseProgress
5
5
 
6
- attr_accessor :prefix_day_labels
6
+ # @dynamic prefix_day_labels
7
7
 
8
8
  def moromi_tome_day
9
9
  prefix_day_labels&.length
@@ -22,19 +22,19 @@ module Toji
22
22
  :note,
23
23
  ].freeze
24
24
 
25
- attr_accessor :temps
26
- attr_accessor :preset_temp
27
- attr_accessor :room_temp
28
- attr_accessor :room_psychrometry
25
+ # @dynamic temps
26
+ # @dynamic preset_temp
27
+ # @dynamic room_temp
28
+ # @dynamic room_psychrometry
29
29
 
30
- attr_accessor :baume
31
- attr_accessor :nihonshudo
32
- attr_accessor :acid
33
- attr_accessor :amino_acid
34
- attr_accessor :alcohol
30
+ # @dynamic baume
31
+ # @dynamic nihonshudo
32
+ # @dynamic acid
33
+ # @dynamic amino_acid
34
+ # @dynamic alcohol
35
35
 
36
- attr_accessor :warmings
37
- attr_accessor :note
36
+ # @dynamic warmings
37
+ # @dynamic note
38
38
 
39
39
  def moromi_day
40
40
  _tome_day = progress.moromi_tome_day
@@ -16,16 +16,16 @@ module Toji
16
16
  :note,
17
17
  ].freeze
18
18
 
19
- attr_accessor :temps
20
- attr_accessor :preset_temp
21
- attr_accessor :room_temp
22
- attr_accessor :room_psychrometry
19
+ # @dynamic temps
20
+ # @dynamic preset_temp
21
+ # @dynamic room_temp
22
+ # @dynamic room_psychrometry
23
23
 
24
- attr_accessor :baume
25
- attr_accessor :acid
24
+ # @dynamic baume
25
+ # @dynamic acid
26
26
 
27
- attr_accessor :warmings
28
- attr_accessor :note
27
+ # @dynamic warmings
28
+ # @dynamic note
29
29
  end
30
30
  end
31
31
  end
@@ -1,15 +1,16 @@
1
1
  module Toji
2
2
  module Progress
3
3
  module Progress
4
- attr_reader :states
5
- attr_reader :date_line
4
+ # @dynamic states
5
+ # @dynamic date_line
6
6
 
7
- attr_reader :base_time
8
- attr_reader :day_offset
9
- attr_reader :days
10
- attr_reader :day_labels
7
+ # @dynamic base_time
8
+ # @dynamic day_offset
9
+ # @dynamic days
10
+ # @dynamic day_labels
11
11
 
12
- attr_reader :all_keys
12
+ # @dynamic all_keys
13
+ # @dynamic has_keys
13
14
  end
14
15
  end
15
16
  end
@@ -3,7 +3,20 @@ require 'toji/progress/state/nihonshudo_to_baume'
3
3
 
4
4
  module Toji
5
5
  module Progress
6
- module BaseState
6
+ module State
7
+ # @dynamic progress
8
+ # @dynamic progress=
9
+
10
+ # @dynamic time
11
+ # @dynamic time=
12
+ # @dynamic mark
13
+ # @dynamic mark=
14
+
15
+ # @dynamic elapsed_time
16
+ # @dynamic elapsed_time_with_offset
17
+ # @dynamic day
18
+ # @dynamic day_label
19
+ # @dynamic display_time
7
20
  end
8
21
  end
9
22
  end
@@ -4,15 +4,13 @@ require 'toji/recipe/ab_expect'
4
4
 
5
5
  module Toji
6
6
  module Recipe
7
- attr_reader :steps
8
- attr_reader :actions
9
- attr_reader :has_moto
10
- attr_reader :has_moromi
11
- attr_reader :ab_coef
12
- attr_reader :ab_expects
7
+ # @dynamic steps
8
+ # @dynamic actions
9
+ # @dynamic ab_coef
10
+ # @dynamic ab_expects
13
11
 
14
12
  def scale_rice_total(rice_total)
15
- ratio = rice_total / steps.map(&:rice_total).sum
13
+ ratio = rice_total.to_f / steps.map(&:rice_total).sum
16
14
  scale(ratio)
17
15
  end
18
16
 
@@ -1,8 +1,8 @@
1
1
  module Toji
2
2
  module Recipe
3
3
  module AbExpect
4
- attr_reader :alcohol
5
- attr_reader :nihonshudo
4
+ # @dynamic alcohol
5
+ # @dynamic nihonshudo
6
6
  end
7
7
  end
8
8
  end
@@ -1,8 +1,8 @@
1
1
  module Toji
2
2
  module Recipe
3
3
  module Action
4
- attr_reader :type
5
- attr_reader :interval_days
4
+ # @dynamic type
5
+ # @dynamic interval_days
6
6
  end
7
7
  end
8
8
  end
@@ -1,12 +1,21 @@
1
1
  module Toji
2
2
  module Recipe
3
3
  module Step
4
- attr_accessor :kojis
5
- attr_accessor :kakes
6
- attr_accessor :waters
7
- attr_accessor :lactic_acids
8
- attr_accessor :alcohols
9
- attr_accessor :yeasts
4
+ # @dynamic index
5
+ # @dynamic subindex
6
+
7
+ # @dynamic kojis
8
+ # @dynamic kojis=
9
+ # @dynamic kakes
10
+ # @dynamic kakes=
11
+ # @dynamic waters
12
+ # @dynamic waters=
13
+ # @dynamic lactic_acids
14
+ # @dynamic lactic_acids=
15
+ # @dynamic alcohols
16
+ # @dynamic alcohols=
17
+ # @dynamic yeasts
18
+ # @dynamic yeasts=
10
19
 
11
20
  # 麹米
12
21
  def koji_total
@@ -3,7 +3,7 @@ module Toji
3
3
  module ActionSchedule
4
4
  include Base
5
5
 
6
- attr_reader :index
6
+ # @dynamic action_index
7
7
  end
8
8
  end
9
9
  end
@@ -1,9 +1,9 @@
1
1
  module Toji
2
2
  module Schedule
3
3
  module Base
4
- attr_reader :product
5
- attr_reader :date
6
- attr_reader :type
4
+ # @dynamic product
5
+ # @dynamic date
6
+ # @dynamic type
7
7
  end
8
8
  end
9
9
  end
@@ -3,10 +3,10 @@ module Toji
3
3
  module RiceSchedule
4
4
  include Base
5
5
 
6
- attr_reader :rice_type
7
- attr_reader :step_indexes
6
+ # @dynamic rice_type
7
+ # @dynamic step_indexes
8
8
 
9
- attr_reader :expect
9
+ # @dynamic expect
10
10
 
11
11
  def type
12
12
  :rice
@@ -1,3 +1,3 @@
1
1
  module Toji
2
- VERSION = "2.13.0"
2
+ VERSION = "2.17.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.13.0
4
+ version: 2.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshida Tetsuya
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-01 00:00:00.000000000 Z
11
+ date: 2020-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -194,7 +194,7 @@ metadata:
194
194
  homepage_uri: https://github.com/yoshida-eth0/ruby-toji
195
195
  source_code_uri: https://github.com/yoshida-eth0/ruby-toji
196
196
  changelog_uri: https://github.com/yoshida-eth0/ruby-toji
197
- post_install_message:
197
+ post_install_message:
198
198
  rdoc_options: []
199
199
  require_paths:
200
200
  - lib
@@ -209,8 +209,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
209
  - !ruby/object:Gem::Version
210
210
  version: '0'
211
211
  requirements: []
212
- rubygems_version: 3.1.2
213
- signing_key:
212
+ rubygems_version: 3.2.0.rc.1
213
+ signing_key:
214
214
  specification_version: 4
215
215
  summary: Management tools for brewing japanese sake.
216
216
  test_files: []