toji 2.7.1 → 2.12.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,14 +1,15 @@
1
1
  require 'toji/recipe/step'
2
+ require 'toji/recipe/action'
2
3
  require 'toji/recipe/ab_expect'
3
4
 
4
5
  module Toji
5
6
  module Recipe
6
7
  attr_accessor :steps
7
- attr_accessor :has_shubo
8
+ attr_accessor :actions
9
+ attr_accessor :has_moto
8
10
  attr_accessor :has_moromi
9
11
  attr_accessor :ab_coef
10
12
  attr_accessor :ab_expects
11
- attr_accessor :squeeze_interval_days
12
13
 
13
14
  def scale(rice_total)
14
15
  rate = rice_total / steps.map(&:rice_total).sum
@@ -18,11 +19,11 @@ module Toji
18
19
 
19
20
  self.class.new.tap {|o|
20
21
  o.steps = new_steps
21
- o.has_shubo = has_shubo
22
+ o.actions = actions.deep_dup
23
+ o.has_moto = has_moto
22
24
  o.has_moromi = has_moromi
23
25
  o.ab_coef = ab_coef
24
26
  o.ab_expects = ab_expects.deep_dup
25
- o.squeeze_interval_days = squeeze_interval_days
26
27
  }
27
28
  end
28
29
 
@@ -33,11 +34,11 @@ module Toji
33
34
 
34
35
  self.class.new.tap {|o|
35
36
  o.steps = new_steps
36
- o.has_shubo = has_shubo
37
+ o.actions = actions.deep_dup
38
+ o.has_moto = has_moto
37
39
  o.has_moromi = has_moromi
38
40
  o.ab_coef = ab_coef
39
41
  o.ab_expects = ab_expects.deep_dup
40
- o.squeeze_interval_days = squeeze_interval_days
41
42
  }
42
43
  end
43
44
 
@@ -51,12 +52,12 @@ module Toji
51
52
  end
52
53
 
53
54
  # 酒母歩合の累計
54
- def cumulative_shubo_rates
55
+ def cumulative_moto_rates
55
56
  rice_total = steps.map(&:rice_total)
56
- shubo = rice_total.first
57
+ moto = rice_total.first
57
58
 
58
59
  rice_total.map.with_index {|x,i|
59
- shubo / rice_total[0..i].inject(&:+)
60
+ moto / rice_total[0..i].inject(&:+)
60
61
  }
61
62
  end
62
63
 
@@ -66,8 +67,8 @@ module Toji
66
67
  # 汲水歩合が大きい高温糖化酒母では6%程度である
67
68
  #
68
69
  # 出典: 酒造教本 P96
69
- def shubo_rate
70
- cumulative_shubo_rates.last || 0.0
70
+ def moto_rate
71
+ cumulative_moto_rates.last || 0.0
71
72
  end
72
73
 
73
74
  # 白米比率
@@ -85,7 +86,7 @@ module Toji
85
86
  end
86
87
 
87
88
  def table_data
88
- headers = [""] + steps.map(&:name) + [:total]
89
+ headers = [""] + steps.map.with_index{|s,i| :"step#{i}"} + [:total]
89
90
  keys = [:rice_total, :kake, :koji, :alcohol, :water, :lactic_acid]
90
91
 
91
92
  cells = [keys]
@@ -0,0 +1,8 @@
1
+ module Toji
2
+ module Recipe
3
+ module Action
4
+ attr_accessor :type
5
+ attr_accessor :interval_days
6
+ end
7
+ end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module Toji
2
- VERSION = "2.7.1"
2
+ VERSION = "2.12.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.7.1
4
+ version: 2.12.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-09-06 00:00:00.000000000 Z
11
+ date: 2020-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -122,10 +122,9 @@ files:
122
122
  - example/moromi.ipynb
123
123
  - example/moromi.rb
124
124
  - example/moromi.yaml
125
+ - example/moto.rb
126
+ - example/moto.yaml
125
127
  - example/recipe.rb
126
- - example/shubo.ipynb
127
- - example/shubo.rb
128
- - example/shubo.yaml
129
128
  - lib/toji.rb
130
129
  - lib/toji/brew.rb
131
130
  - lib/toji/brew/base.rb
@@ -137,12 +136,18 @@ files:
137
136
  - lib/toji/brew/graph/progress.rb
138
137
  - lib/toji/brew/koji.rb
139
138
  - lib/toji/brew/moromi.rb
140
- - lib/toji/brew/shubo.rb
139
+ - lib/toji/brew/moto.rb
141
140
  - lib/toji/brew/state.rb
142
141
  - lib/toji/brew/wrapped_state.rb
143
142
  - lib/toji/calendar.rb
144
143
  - lib/toji/calendar/date_column.rb
145
144
  - lib/toji/calendar/date_row.rb
145
+ - lib/toji/event.rb
146
+ - lib/toji/event/action_event.rb
147
+ - lib/toji/event/base.rb
148
+ - lib/toji/event/kake_event.rb
149
+ - lib/toji/event/koji_event.rb
150
+ - lib/toji/event/rice_event.rb
146
151
  - lib/toji/ingredient.rb
147
152
  - lib/toji/ingredient/kake.rb
148
153
  - lib/toji/ingredient/kake/actual.rb
@@ -161,11 +166,10 @@ files:
161
166
  - lib/toji/ingredient/rice/expected_steamable.rb
162
167
  - lib/toji/ingredient/rice_rate.rb
163
168
  - lib/toji/product.rb
164
- - lib/toji/product/event.rb
165
- - lib/toji/product/rice_event.rb
166
- - lib/toji/product/rice_event_group.rb
169
+ - lib/toji/product/event_factory.rb
167
170
  - lib/toji/recipe.rb
168
171
  - lib/toji/recipe/ab_expect.rb
172
+ - lib/toji/recipe/action.rb
169
173
  - lib/toji/recipe/step.rb
170
174
  - lib/toji/version.rb
171
175
  - toji.gemspec
@@ -191,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
195
  - !ruby/object:Gem::Version
192
196
  version: '0'
193
197
  requirements: []
194
- rubygems_version: 3.0.4
198
+ rubygems_version: 3.1.2
195
199
  signing_key:
196
200
  specification_version: 4
197
201
  summary: Management tools for brewing japanese sake.
@@ -1,121 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": 1,
6
- "metadata": {},
7
- "outputs": [
8
- {
9
- "data": {
10
- "text/html": [
11
- "\n",
12
- " <script>\n",
13
- " requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min'] }})\n",
14
- " </script>\n",
15
- "\n",
16
- "\n",
17
- "<div id=\"105867eb-e572-490c-8509-e506179e76ad\" style=\"height: 100%; width: 100%;\"></div>\n",
18
- "\n",
19
- "<script>\n",
20
- " require(['plotly'], function(Plotly) { \n",
21
- "Plotly.newPlot(\n",
22
- " '105867eb-e572-490c-8509-e506179e76ad',\n",
23
- " [{\"x\":[0.0,3600.0,86400.0,172800.0,172801.0,259200.0,259201.0,345600.0,345601.0,432000.0,518400.0,604800.0,691200.0,777600.0,864000.0,950400.0,1036800.0,1123200.0],\"y\":[12.0,20.0,14.0,8.0,11.0,10.0,13.0,12.0,15.0,14.0,20.0,20.0,20.0,20.0,15.0,12.0,10.0,9.0],\"text\":[\"01/16 00:00\",\"01/16 01:00\",\"01/17 00:00\",\"01/18 00:00\",\"01/18 00:00\",\"01/19 00:00\",\"01/19 00:00\",\"01/20 00:00\",\"01/20 00:00\",\"01/21 00:00\",\"01/22 00:00\",\"01/23 00:00\",\"01/24 00:00\",\"01/25 00:00\",\"01/26 00:00\",\"01/27 00:00\",\"01/28 00:00\",\"01/29 00:00\"],\"name\":\"temps\",\"line\":{\"dash\":\"solid\",\"shape\":\"linear\"},\"marker\":{\"color\":\"#1f77b4\"}},{\"x\":[86400.0,172800.0,259200.0,345600.0,432000.0,518400.0,604800.0,691200.0,777600.0,864000.0,950400.0,1036800.0,1123200.0],\"y\":[15.0,16.0,16.5,17.0,17.0,17.0,14.0,12.0,9.0,8.0,7.0,6.0,5.0],\"text\":[\"01/17 00:00\",\"01/18 00:00\",\"01/19 00:00\",\"01/20 00:00\",\"01/21 00:00\",\"01/22 00:00\",\"01/23 00:00\",\"01/24 00:00\",\"01/25 00:00\",\"01/26 00:00\",\"01/27 00:00\",\"01/28 00:00\",\"01/29 00:00\"],\"name\":\"baume\",\"line\":{\"dash\":\"solid\",\"shape\":\"linear\"},\"marker\":{\"color\":\"#9467bd\"}},{\"x\":[0.0,3600.0,86400.0,172800.0,259200.0,345600.0,432000.0,518400.0,604800.0,691200.0,777600.0,864000.0,950400.0,1036800.0,1123200.0],\"y\":[13.0,13.0,13.0,13.0,13.5,13.5,14.0,14.5,15.5,16.0,16.0,16.5,17.0,17.5,17.5],\"text\":[\"01/16 00:00\",\"01/16 01:00\",\"01/17 00:00\",\"01/18 00:00\",\"01/19 00:00\",\"01/20 00:00\",\"01/21 00:00\",\"01/22 00:00\",\"01/23 00:00\",\"01/24 00:00\",\"01/25 00:00\",\"01/26 00:00\",\"01/27 00:00\",\"01/28 00:00\",\"01/29 00:00\"],\"name\":\"acid\",\"line\":{\"dash\":\"solid\",\"shape\":\"linear\"},\"marker\":{\"color\":\"#8c564b\"}}],\n",
24
- " {\"xaxis\":{\"dtick\":86400,\"tickvals\":[0,86400,172800,259200,345600,432000,518400,604800,691200,777600,864000,950400,1036800,1123200],\"ticktext\":[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\"]},\"annotations\":[{\"x\":0.0,\"y\":12.0,\"xref\":\"x\",\"yref\":\"y\",\"text\":\"水麹\",\"showarrow\":true,\"arrowhead\":1,\"ax\":0,\"ay\":-40},{\"x\":3600.0,\"y\":20.0,\"xref\":\"x\",\"yref\":\"y\",\"text\":\"仕込み\",\"showarrow\":true,\"arrowhead\":1,\"ax\":0,\"ay\":-40},{\"x\":86400.0,\"y\":14.0,\"xref\":\"x\",\"yref\":\"y\",\"text\":\"打瀬\",\"showarrow\":true,\"arrowhead\":1,\"ax\":0,\"ay\":-40},{\"x\":777600.0,\"y\":20.0,\"xref\":\"x\",\"yref\":\"y\",\"text\":\"分け\",\"showarrow\":true,\"arrowhead\":1,\"ax\":0,\"ay\":-40}]},\n",
25
- " {\"linkText\":\"Export to plot.ly\",\"showLink\":true}\n",
26
- ")\n",
27
- "\n",
28
- "window.addEventListener('resize', function() {\n",
29
- " Plotly.Plots.resize(document.getElementById('105867eb-e572-490c-8509-e506179e76ad'))\n",
30
- "})\n",
31
- " }) \n",
32
- "</script>"
33
- ],
34
- "text/plain": [
35
- "#<Plotly::Offline::HTML:0x00007f983ea69c48 @id=\"105867eb-e572-490c-8509-e506179e76ad\", @data=[{:x=>[0.0, 3600.0, 86400.0, 172800.0, 172801.0, 259200.0, 259201.0, 345600.0, 345601.0, 432000.0, 518400.0, 604800.0, 691200.0, 777600.0, 864000.0, 950400.0, 1036800.0, 1123200.0], :y=>[12.0, 20.0, 14.0, 8.0, 11.0, 10.0, 13.0, 12.0, 15.0, 14.0, 20.0, 20.0, 20.0, 20.0, 15.0, 12.0, 10.0, 9.0], :text=>[\"01/16 00:00\", \"01/16 01:00\", \"01/17 00:00\", \"01/18 00:00\", \"01/18 00:00\", \"01/19 00:00\", \"01/19 00:00\", \"01/20 00:00\", \"01/20 00:00\", \"01/21 00:00\", \"01/22 00:00\", \"01/23 00:00\", \"01/24 00:00\", \"01/25 00:00\", \"01/26 00:00\", \"01/27 00:00\", \"01/28 00:00\", \"01/29 00:00\"], :name=>\"temps\", :line=>{:dash=>:solid, :shape=>:linear}, :marker=>{:color=>\"#1f77b4\"}}, {:x=>[86400.0, 172800.0, 259200.0, 345600.0, 432000.0, 518400.0, 604800.0, 691200.0, 777600.0, 864000.0, 950400.0, 1036800.0, 1123200.0], :y=>[15.0, 16.0, 16.5, 17.0, 17.0, 17.0, 14.0, 12.0, 9.0, 8.0, 7.0, 6.0, 5.0], :text=>[\"01/17 00:00\", \"01/18 00:00\", \"01/19 00:00\", \"01/20 00:00\", \"01/21 00:00\", \"01/22 00:00\", \"01/23 00:00\", \"01/24 00:00\", \"01/25 00:00\", \"01/26 00:00\", \"01/27 00:00\", \"01/28 00:00\", \"01/29 00:00\"], :name=>\"baume\", :line=>{:dash=>:solid, :shape=>:linear}, :marker=>{:color=>\"#9467bd\"}}, {:x=>[0.0, 3600.0, 86400.0, 172800.0, 259200.0, 345600.0, 432000.0, 518400.0, 604800.0, 691200.0, 777600.0, 864000.0, 950400.0, 1036800.0, 1123200.0], :y=>[13.0, 13.0, 13.0, 13.0, 13.5, 13.5, 14.0, 14.5, 15.5, 16.0, 16.0, 16.5, 17.0, 17.5, 17.5], :text=>[\"01/16 00:00\", \"01/16 01:00\", \"01/17 00:00\", \"01/18 00:00\", \"01/19 00:00\", \"01/20 00:00\", \"01/21 00:00\", \"01/22 00:00\", \"01/23 00:00\", \"01/24 00:00\", \"01/25 00:00\", \"01/26 00:00\", \"01/27 00:00\", \"01/28 00:00\", \"01/29 00:00\"], :name=>\"acid\", :line=>{:dash=>:solid, :shape=>:linear}, :marker=>{:color=>\"#8c564b\"}}], @layout={:xaxis=>{:dtick=>86400, :tickvals=>[0, 86400, 172800, 259200, 345600, 432000, 518400, 604800, 691200, 777600, 864000, 950400, 1036800, 1123200], :ticktext=>[\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\", \"13\", \"14\"]}, :annotations=>[{:x=>0.0, :y=>12.0, :xref=>\"x\", :yref=>\"y\", :text=>\"水麹\", :showarrow=>true, :arrowhead=>1, :ax=>0, :ay=>-40}, {:x=>3600.0, :y=>20.0, :xref=>\"x\", :yref=>\"y\", :text=>\"仕込み\", :showarrow=>true, :arrowhead=>1, :ax=>0, :ay=>-40}, {:x=>86400.0, :y=>14.0, :xref=>\"x\", :yref=>\"y\", :text=>\"打瀬\", :showarrow=>true, :arrowhead=>1, :ax=>0, :ay=>-40}, {:x=>777600.0, :y=>20.0, :xref=>\"x\", :yref=>\"y\", :text=>\"分け\", :showarrow=>true, :arrowhead=>1, :ax=>0, :ay=>-40}]}, @config={:linkText=>\"Export to plot.ly\", :showLink=>true}, @embedded=true>"
36
- ]
37
- },
38
- "metadata": {},
39
- "output_type": "display_data"
40
- },
41
- {
42
- "data": {
43
- "text/html": [
44
- "\n",
45
- " <script>\n",
46
- " requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min'] }})\n",
47
- " </script>\n",
48
- "\n",
49
- "\n",
50
- "<div id=\"23560ab9-b0dc-4006-9779-b9219ab608c6\" style=\"height: 100%; width: 100%;\"></div>\n",
51
- "\n",
52
- "<script>\n",
53
- " require(['plotly'], function(Plotly) { \n",
54
- "Plotly.newPlot(\n",
55
- " '23560ab9-b0dc-4006-9779-b9219ab608c6',\n",
56
- " [{\"type\":\"table\",\"header\":{\"values\":[\"day_label\",\"display_time\",\"mark\",\"temps\",\"display_baume\",\"acid\",\"warmings\"]},\"cells\":{\"values\":[[\"1\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\"],[\"01/16 00:00\",\"01/16 01:00\",\"01/17 00:00\",\"01/18 00:00\",\"01/19 00:00\",\"01/20 00:00\",\"01/21 00:00\",\"01/22 00:00\",\"01/23 00:00\",\"01/24 00:00\",\"01/25 00:00\",\"01/26 00:00\",\"01/27 00:00\",\"01/28 00:00\",\"01/29 00:00\"],[\"水麹\",\"仕込み\",\"打瀬\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"分け\",\"\",\"\",\"\",\"\"],[\"12.0\",\"20.0\",\"14.0\",\"8.0, 11.0\",\"10.0, 13.0\",\"12.0, 15.0\",\"14.0\",\"20.0\",\"20.0\",\"20.0\",\"20.0\",\"15.0\",\"12.0\",\"10.0\",\"9.0\"],[\"\",\"\",15.0,16.0,16.5,17.0,17.0,17.0,14.0,12.0,9.0,8.0,7.0,6.0,5.0],[13.0,13.0,13.0,13.0,13.5,13.5,14.0,14.5,15.5,16.0,16.0,16.5,17.0,17.5,17.5],[\"\",\"\",\"\",\"暖気\",\"暖気\",\"暖気\",\"行火\",\"行火\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]]}}],\n",
57
- " {\"height\":650},\n",
58
- " {\"linkText\":\"Export to plot.ly\",\"showLink\":true}\n",
59
- ")\n",
60
- "\n",
61
- "window.addEventListener('resize', function() {\n",
62
- " Plotly.Plots.resize(document.getElementById('23560ab9-b0dc-4006-9779-b9219ab608c6'))\n",
63
- "})\n",
64
- " }) \n",
65
- "</script>"
66
- ],
67
- "text/plain": [
68
- "#<Plotly::Offline::HTML:0x00007f9841041718 @id=\"23560ab9-b0dc-4006-9779-b9219ab608c6\", @data=[{:type=>:table, :header=>{:values=>[:day_label, :display_time, :mark, :temps, :display_baume, :acid, :warmings]}, :cells=>{:values=>[[\"1\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\", \"13\", \"14\"], [\"01/16 00:00\", \"01/16 01:00\", \"01/17 00:00\", \"01/18 00:00\", \"01/19 00:00\", \"01/20 00:00\", \"01/21 00:00\", \"01/22 00:00\", \"01/23 00:00\", \"01/24 00:00\", \"01/25 00:00\", \"01/26 00:00\", \"01/27 00:00\", \"01/28 00:00\", \"01/29 00:00\"], [\"水麹\", \"仕込み\", \"打瀬\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"分け\", \"\", \"\", \"\", \"\"], [\"12.0\", \"20.0\", \"14.0\", \"8.0, 11.0\", \"10.0, 13.0\", \"12.0, 15.0\", \"14.0\", \"20.0\", \"20.0\", \"20.0\", \"20.0\", \"15.0\", \"12.0\", \"10.0\", \"9.0\"], [\"\", \"\", 15.0, 16.0, 16.5, 17.0, 17.0, 17.0, 14.0, 12.0, 9.0, 8.0, 7.0, 6.0, 5.0], [13.0, 13.0, 13.0, 13.0, 13.5, 13.5, 14.0, 14.5, 15.5, 16.0, 16.0, 16.5, 17.0, 17.5, 17.5], [\"\", \"\", \"\", \"暖気\", \"暖気\", \"暖気\", \"行火\", \"行火\", \"\", \"\", \"\", \"\", \"\", \"\", \"\"]]}}], @layout={:height=>650}, @config={:linkText=>\"Export to plot.ly\", :showLink=>true}, @embedded=true>"
69
- ]
70
- },
71
- "metadata": {},
72
- "output_type": "display_data"
73
- },
74
- {
75
- "data": {
76
- "text/plain": [
77
- "#<CZTop::Socket::PUB:0x7f984321b6b0 last_endpoint=\"tcp://127.0.0.1:56600\">"
78
- ]
79
- },
80
- "execution_count": 1,
81
- "metadata": {},
82
- "output_type": "execute_result"
83
- }
84
- ],
85
- "source": [
86
- "$LOAD_PATH << File.dirname(__FILE__) + \"/../lib\"\n",
87
- "require 'toji'\n",
88
- "require './example_core'\n",
89
- "require 'rbplotly'\n",
90
- "\n",
91
- "shubo = Example::Brew::Shubo.load_yaml_file(\"shubo.yaml\")\n",
92
- "shubo.progress.plot.show\n",
93
- "shubo.progress.table.tap {|t|\n",
94
- " t.layout.height = 650\n",
95
- "}.show"
96
- ]
97
- },
98
- {
99
- "cell_type": "code",
100
- "execution_count": null,
101
- "metadata": {},
102
- "outputs": [],
103
- "source": []
104
- }
105
- ],
106
- "metadata": {
107
- "kernelspec": {
108
- "display_name": "Ruby 2.7.1",
109
- "language": "ruby",
110
- "name": "ruby"
111
- },
112
- "language_info": {
113
- "file_extension": ".rb",
114
- "mimetype": "application/x-ruby",
115
- "name": "ruby",
116
- "version": "2.6.3"
117
- }
118
- },
119
- "nbformat": 4,
120
- "nbformat_minor": 2
121
- }
@@ -1,13 +0,0 @@
1
- module Toji
2
- module Product
3
- class Event
4
- attr_reader :date
5
- attr_reader :type
6
-
7
- def initialize(date, type)
8
- @date = date
9
- @type = type
10
- end
11
- end
12
- end
13
- end
@@ -1,28 +0,0 @@
1
- require 'toji/product/event'
2
-
3
- module Toji
4
- module Product
5
- class RiceEvent < Event
6
- attr_reader :product
7
- attr_reader :index
8
- attr_reader :group_index
9
- attr_reader :weight
10
-
11
- def initialize(product:, type:, index:, group_index:, date:, weight:)
12
- super(date, type)
13
- @product = product
14
- @index = index
15
- @group_index = group_index
16
- @weight = weight
17
- end
18
-
19
- def group_key
20
- a = []
21
- a << product.reduce_key
22
- a << type
23
- a << group_index
24
- a.map(&:to_s).join(":")
25
- end
26
- end
27
- end
28
- end
@@ -1,19 +0,0 @@
1
- require 'toji/product/event'
2
-
3
- module Toji
4
- module Product
5
- class RiceEventGroup < Event
6
- attr_reader :breakdown
7
-
8
- def initialize(events)
9
- o = events.first
10
- super(o&.date, o&.type)
11
- @breakdown = events
12
- end
13
-
14
- def weight
15
- @breakdown.map(&:weight).sum
16
- end
17
- end
18
- end
19
- end