toji 2.28.0 → 2.29.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 +4 -4
- data/example/example_core.rb +15 -5
- data/lib/toji/ingredient/rice.rb +1 -0
- data/lib/toji/product.rb +33 -0
- data/lib/toji/recipe/action.rb +1 -0
- data/lib/toji/recipe/step.rb +2 -0
- data/lib/toji/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a87950a671a099c992cc3b8a8c94038f49c9f533a78cabe066562b1f15a69ff2
|
4
|
+
data.tar.gz: e3ff465a5367b75e13110a09953232249380df0c378b4ca08b5bce0e587ab028
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cd4227adc3c79f4d6d8e85305a84a5bd5220fb92edabb154b6f5294102e307d32088ab7034fcfc688e21af23804706d36be86e8dc2cf5abdde870e96f132a6b
|
7
|
+
data.tar.gz: 1450e1cf798268cc889e15d3fc4a81b6bbe79ff263c7cb6f6e30569e03ce2618686bff5ed47722291b98b6712d200e5366bd0d40e2c17fbfc63e9339d42358bb
|
data/example/example_core.rb
CHANGED
@@ -10,7 +10,7 @@ module Example
|
|
10
10
|
|
11
11
|
attr_reader :serial_num
|
12
12
|
attr_reader :recipe
|
13
|
-
|
13
|
+
attr_accessor :base_date
|
14
14
|
|
15
15
|
attr_reader :description
|
16
16
|
attr_reader :color
|
@@ -94,6 +94,7 @@ module Example
|
|
94
94
|
|
95
95
|
attr_reader :index
|
96
96
|
attr_reader :subindex
|
97
|
+
attr_accessor :interval_days
|
97
98
|
attr_accessor :kojis
|
98
99
|
attr_accessor :kakes
|
99
100
|
attr_accessor :waters
|
@@ -101,9 +102,10 @@ module Example
|
|
101
102
|
attr_accessor :alcohols
|
102
103
|
attr_accessor :yeasts
|
103
104
|
|
104
|
-
def initialize(index:, subindex:, kojis: [], kakes: [], waters: [], lactic_acids: [], alcohols: [], yeasts: [])
|
105
|
+
def initialize(index:, subindex:, interval_days:, kojis: [], kakes: [], waters: [], lactic_acids: [], alcohols: [], yeasts: [])
|
105
106
|
@index = index
|
106
107
|
@subindex = subindex
|
108
|
+
@interval_days = interval_days
|
107
109
|
@kojis = kojis
|
108
110
|
@kakes = kakes
|
109
111
|
@waters = waters
|
@@ -113,6 +115,9 @@ module Example
|
|
113
115
|
end
|
114
116
|
|
115
117
|
def initialize_copy(obj)
|
118
|
+
@index = obj.index
|
119
|
+
@subindex = obj.subindex
|
120
|
+
@interval_days = obj.interval_days
|
116
121
|
@kojis = obj.kojis.deep_dup
|
117
122
|
@kakes = obj.kakes.deep_dup
|
118
123
|
@waters = obj.waters.deep_dup
|
@@ -136,7 +141,7 @@ module Example
|
|
136
141
|
attr_reader :cooling_ratio
|
137
142
|
attr_reader :tanekojis
|
138
143
|
attr_reader :dekoji_ratio
|
139
|
-
|
144
|
+
attr_accessor :interval_days
|
140
145
|
attr_reader :process_group
|
141
146
|
|
142
147
|
def initialize(weight:, brand:, polishing_ratio:, made_in:, farmer:, rice_year:, soaking_ratio:, steaming_ratio:, cooling_ratio:, tanekojis:, dekoji_ratio:, interval_days:)
|
@@ -209,7 +214,7 @@ module Example
|
|
209
214
|
attr_reader :soaking_ratio
|
210
215
|
attr_reader :steaming_ratio
|
211
216
|
attr_reader :cooling_ratio
|
212
|
-
|
217
|
+
attr_accessor :interval_days
|
213
218
|
attr_reader :process_group
|
214
219
|
|
215
220
|
def initialize(weight:, brand:, polishing_ratio:, made_in:, farmer:, rice_year:, soaking_ratio:, steaming_ratio:, cooling_ratio:, interval_days:)
|
@@ -275,7 +280,7 @@ module Example
|
|
275
280
|
include Toji::Recipe::Action
|
276
281
|
|
277
282
|
attr_reader :type
|
278
|
-
|
283
|
+
attr_accessor :interval_days
|
279
284
|
|
280
285
|
def initialize(type:, interval_days:)
|
281
286
|
@type = type
|
@@ -332,6 +337,7 @@ module Example
|
|
332
337
|
Step.new(
|
333
338
|
index: 0,
|
334
339
|
subindex: 0,
|
340
|
+
interval_days: 0,
|
335
341
|
kojis: [
|
336
342
|
Koji.new(
|
337
343
|
weight: 20,
|
@@ -386,6 +392,7 @@ module Example
|
|
386
392
|
Step.new(
|
387
393
|
index: 1,
|
388
394
|
subindex: 0,
|
395
|
+
interval_days: 20,
|
389
396
|
kojis: [
|
390
397
|
Koji.new(
|
391
398
|
weight: 40,
|
@@ -430,6 +437,7 @@ module Example
|
|
430
437
|
Step.new(
|
431
438
|
index: 2,
|
432
439
|
subindex: 0,
|
440
|
+
interval_days: 22,
|
433
441
|
kojis: [
|
434
442
|
Koji.new(
|
435
443
|
weight: 60,
|
@@ -474,6 +482,7 @@ module Example
|
|
474
482
|
Step.new(
|
475
483
|
index: 3,
|
476
484
|
subindex: 0,
|
485
|
+
interval_days: 23,
|
477
486
|
kojis: [
|
478
487
|
Koji.new(
|
479
488
|
weight: 80,
|
@@ -518,6 +527,7 @@ module Example
|
|
518
527
|
Step.new(
|
519
528
|
index: 4,
|
520
529
|
subindex: 0,
|
530
|
+
interval_days: 48,
|
521
531
|
kakes: [
|
522
532
|
Kake.new(
|
523
533
|
weight: 80,
|
data/lib/toji/ingredient/rice.rb
CHANGED
data/lib/toji/product.rb
CHANGED
@@ -5,11 +5,44 @@ module Toji
|
|
5
5
|
# @dynamic serial_num
|
6
6
|
# @dynamic recipe
|
7
7
|
# @dynamic base_date
|
8
|
+
# @dynamic base_date=
|
8
9
|
|
9
10
|
# @dynamic koji_schedules
|
10
11
|
# @dynamic kake_schedules
|
11
12
|
# @dynamic action_schedules
|
12
13
|
# @dynamic rice_schedules
|
13
14
|
# @dynamic schedules
|
15
|
+
|
16
|
+
def compact!
|
17
|
+
recipe&.compact!
|
18
|
+
|
19
|
+
min_interval_days = [
|
20
|
+
recipe&.steps&.map(&:interval_days)&.min,
|
21
|
+
recipe&.steps&.flat_map{|step| step.rices.to_a}&.map(&:interval_days)&.min,
|
22
|
+
recipe&.actions&.map(&:interval_days)&.min,
|
23
|
+
].compact.min
|
24
|
+
|
25
|
+
if min_interval_days && min_interval_days!=0
|
26
|
+
recipe&.steps&.each {|step|
|
27
|
+
step.interval_days -= min_interval_days
|
28
|
+
step.rices {|rice|
|
29
|
+
rice.interval_days -= min_interval_days
|
30
|
+
}
|
31
|
+
}
|
32
|
+
recipe&.actions&.each {|action|
|
33
|
+
action.interval_days -= min_interval_days
|
34
|
+
}
|
35
|
+
self.base_date = base_date.since(min_interval_days.days)
|
36
|
+
end
|
37
|
+
|
38
|
+
self
|
39
|
+
end
|
40
|
+
|
41
|
+
def compact
|
42
|
+
Utils.check_dup(self)
|
43
|
+
|
44
|
+
dst = self.dup
|
45
|
+
dst.compact!
|
46
|
+
end
|
14
47
|
end
|
15
48
|
end
|
data/lib/toji/recipe/action.rb
CHANGED
data/lib/toji/recipe/step.rb
CHANGED
data/lib/toji/version.rb
CHANGED
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.
|
4
|
+
version: 2.29.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: 2021-04-
|
11
|
+
date: 2021-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|