toji 2.14.0 → 2.15.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: 37499051191a04bbfe3557557db95602364782e93cabca5a8c66df22b0f23a2a
4
- data.tar.gz: eb22b32536b32ed7d8441ad6586cc7b1d46fe617931272f88930d2b4df511728
3
+ metadata.gz: 992db213aef7df46ad7fb1daf6bdaacf6ef74aa753a5ca9bd3538d808ff55335
4
+ data.tar.gz: ea97a83429363cbe1437433a3abacb51132d2107100ff0e920c2f577970ad548
5
5
  SHA512:
6
- metadata.gz: dd61d83746fa569a42d10cd46450ae7b9b30264f275c87d3795d8749f93814c18105d49e88d5683daa76bf627d89068645c89d7432e8a2dfb3bfe4af3cb7dc62
7
- data.tar.gz: 6563f31a5eed5ec04150b75d5248e0c3b936b1cfdfb0b68f89732b032980f67a1518663c450a7bef3c44468ee5a6069cf4a4b0de8ca92633d5053fe28da690bc
6
+ metadata.gz: 659b02383e2cd9b5014447a5c05227179949b96cb8d899a9828bf486bb42a34658507e6ea12b0f6e1ae150b313837add6f6cf7e558847ddbcc8a1e077c082223
7
+ data.tar.gz: 7927be3a32db507af849963f3f78f90c6f924a1b72df3c9d9395a61285074f45cb50f5f182423068354c1758739b47594778ce71b59d05f92b7f56a74cd1309b
@@ -86,8 +86,9 @@ module Example
86
86
  class Step
87
87
  include Toji::Recipe::Step
88
88
 
89
- def initialize(index:, kojis: [], kakes: [], waters: [], lactic_acids: [], alcohols: [], yeasts: [])
89
+ def initialize(index:, subindex:, kojis: [], kakes: [], waters: [], lactic_acids: [], alcohols: [], yeasts: [])
90
90
  @index = index
91
+ @subindex = subindex
91
92
  @kojis = kojis
92
93
  @kakes = kakes
93
94
  @waters = waters
@@ -246,6 +247,7 @@ module Example
246
247
  [
247
248
  Step.new(
248
249
  index: 0,
250
+ subindex: 0,
249
251
  kojis: [
250
252
  Koji.new(
251
253
  weight: 20,
@@ -297,6 +299,7 @@ module Example
297
299
  ),
298
300
  Step.new(
299
301
  index: 1,
302
+ subindex: 0,
300
303
  kojis: [
301
304
  Koji.new(
302
305
  weight: 40,
@@ -338,6 +341,7 @@ module Example
338
341
  ),
339
342
  Step.new(
340
343
  index: 2,
344
+ subindex: 0,
341
345
  kojis: [
342
346
  Koji.new(
343
347
  weight: 60,
@@ -379,6 +383,7 @@ module Example
379
383
  ),
380
384
  Step.new(
381
385
  index: 3,
386
+ subindex: 0,
382
387
  kojis: [
383
388
  Koji.new(
384
389
  weight: 80,
@@ -420,6 +425,7 @@ module Example
420
425
  ),
421
426
  Step.new(
422
427
  index: 4,
428
+ subindex: 0,
423
429
  kakes: [
424
430
  Kake.new(
425
431
  weight: 80,
@@ -447,6 +453,7 @@ module Example
447
453
  [
448
454
  Step.new(
449
455
  index: 0,
456
+ subindex: 0,
450
457
  kojis: [
451
458
  Koji.new(
452
459
  weight: 47,
@@ -498,6 +505,7 @@ module Example
498
505
  ),
499
506
  Step.new(
500
507
  index: 1,
508
+ subindex: 0,
501
509
  kojis: [
502
510
  Koji.new(
503
511
  weight: 99,
@@ -539,6 +547,7 @@ module Example
539
547
  ),
540
548
  Step.new(
541
549
  index: 2,
550
+ subindex: 0,
542
551
  kojis: [
543
552
  Koji.new(
544
553
  weight: 143,
@@ -580,6 +589,7 @@ module Example
580
589
  ),
581
590
  Step.new(
582
591
  index: 3,
592
+ subindex: 0,
583
593
  kojis: [
584
594
  Koji.new(
585
595
  weight: 165,
@@ -621,6 +631,7 @@ module Example
621
631
  ),
622
632
  Step.new(
623
633
  index: 4,
634
+ subindex: 0,
624
635
  alcohols: [
625
636
  Alcohol.new(
626
637
  weight: 900,
@@ -635,6 +646,7 @@ module Example
635
646
  [
636
647
  Step.new(
637
648
  index: 0,
649
+ subindex: 0,
638
650
  kojis: [
639
651
  Koji.new(
640
652
  weight: 70,
@@ -686,6 +698,7 @@ module Example
686
698
  ),
687
699
  Step.new(
688
700
  index: 1,
701
+ subindex: 0,
689
702
  kojis: [
690
703
  Koji.new(
691
704
  weight: 0,
@@ -727,6 +740,7 @@ module Example
727
740
  ),
728
741
  Step.new(
729
742
  index: 1,
743
+ subindex: 0,
730
744
  kojis: [
731
745
  Koji.new(
732
746
  weight: 100,
@@ -768,6 +782,7 @@ module Example
768
782
  ),
769
783
  Step.new(
770
784
  index: 2,
785
+ subindex: 0,
771
786
  kojis: [
772
787
  Koji.new(
773
788
  weight: 110,
@@ -809,6 +824,7 @@ module Example
809
824
  ),
810
825
  Step.new(
811
826
  index: 3,
827
+ subindex: 0,
812
828
  waters: [
813
829
  Water.new(
814
830
  weight: 255,
@@ -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
@@ -18,7 +18,10 @@ module Toji
18
18
  recipe.steps.inject([]) {|result, step|
19
19
  step.kojis&.each {|koji|
20
20
  result << {
21
- step_index: step.index,
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
  }
@@ -31,7 +34,7 @@ module Toji
31
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
  }
@@ -41,7 +44,10 @@ module Toji
41
44
  recipe.steps.inject([]) {|result, step|
42
45
  step.kakes&.each {|kake|
43
46
  result << {
44
- step_index: step.index,
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
  }
@@ -2,6 +2,7 @@ module Toji
2
2
  module Recipe
3
3
  module Step
4
4
  attr_reader :index
5
+ attr_reader :subindex
5
6
  attr_accessor :kojis
6
7
  attr_accessor :kakes
7
8
  attr_accessor :waters
@@ -1,3 +1,3 @@
1
1
  module Toji
2
- VERSION = "2.14.0"
2
+ VERSION = "2.15.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.14.0
4
+ version: 2.15.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-11-04 00:00:00.000000000 Z
11
+ date: 2020-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -209,7 +209,7 @@ 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
212
+ rubygems_version: 3.0.4
213
213
  signing_key:
214
214
  specification_version: 4
215
215
  summary: Management tools for brewing japanese sake.