toji 1.6.7 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/example/calendar.ipynb +123 -0
  3. data/example/{schedule.yaml → calendar.yaml} +6 -30
  4. data/example/calendar_file.ipynb +338 -0
  5. data/example/example_core.rb +336 -0
  6. data/example/kake_recipe.rb +27 -0
  7. data/example/koji_making.ipynb +16 -15
  8. data/example/koji_making.rb +2 -1
  9. data/example/koji_making.yaml +9 -9
  10. data/example/koji_making_multi.ipynb +26 -25
  11. data/example/koji_recipe.rb +1 -1
  12. data/example/moromi.ipynb +25 -24
  13. data/example/moromi.rb +1 -0
  14. data/example/moromi.yaml +10 -4
  15. data/example/recipe.rb +75 -0
  16. data/example/shubo.ipynb +15 -14
  17. data/example/shubo.rb +2 -1
  18. data/example/shubo.yaml +10 -10
  19. data/lib/toji.rb +3 -1
  20. data/lib/toji/brew.rb +1 -2
  21. data/lib/toji/brew/base.rb +7 -71
  22. data/lib/toji/brew/builder.rb +47 -4
  23. data/lib/toji/brew/graph/bmd.rb +0 -1
  24. data/lib/toji/brew/graph/progress.rb +1 -1
  25. data/lib/toji/brew/koji.rb +0 -10
  26. data/lib/toji/brew/moromi.rb +2 -36
  27. data/lib/toji/brew/shubo.rb +0 -5
  28. data/lib/toji/brew/state.rb +90 -103
  29. data/lib/toji/brew/state_wrapper.rb +135 -0
  30. data/lib/toji/calendar.rb +123 -0
  31. data/lib/toji/{schedule → calendar}/date_column.rb +3 -6
  32. data/lib/toji/{schedule → calendar}/date_row.rb +6 -6
  33. data/lib/toji/ingredient.rb +10 -0
  34. data/lib/toji/ingredient/kake.rb +17 -0
  35. data/lib/toji/ingredient/kake/actual.rb +27 -0
  36. data/lib/toji/ingredient/kake/base.rb +18 -0
  37. data/lib/toji/ingredient/kake/expected.rb +41 -0
  38. data/lib/toji/ingredient/koji.rb +19 -0
  39. data/lib/toji/ingredient/koji/actual.rb +30 -0
  40. data/lib/toji/ingredient/koji/actual_fermentable.rb +15 -0
  41. data/lib/toji/ingredient/koji/base.rb +35 -0
  42. data/lib/toji/ingredient/koji/expected.rb +46 -0
  43. data/lib/toji/ingredient/koji/expected_fermentable.rb +15 -0
  44. data/lib/toji/{recipe → ingredient}/koji_rate.rb +1 -1
  45. data/lib/toji/ingredient/rice.rb +10 -0
  46. data/lib/toji/ingredient/rice/actual_steamable.rb +27 -0
  47. data/lib/toji/ingredient/rice/base.rb +41 -0
  48. data/lib/toji/ingredient/rice/expected_steamable.rb +29 -0
  49. data/lib/toji/ingredient/rice_rate.rb +35 -0
  50. data/lib/toji/product.rb +65 -0
  51. data/lib/toji/{schedule/product_event.rb → product/event.rb} +4 -4
  52. data/lib/toji/recipe.rb +120 -5
  53. data/lib/toji/recipe/step.rb +46 -59
  54. data/lib/toji/version.rb +1 -1
  55. metadata +31 -37
  56. data/example/rice_recipe.rb +0 -28
  57. data/example/schedule.ipynb +0 -393
  58. data/example/schedule_file.ipynb +0 -337
  59. data/example/three_step_mashing_recipe.rb +0 -67
  60. data/lib/toji/brew/state_accessor.rb +0 -13
  61. data/lib/toji/brew/state_record.rb +0 -72
  62. data/lib/toji/recipe/ingredient.rb +0 -10
  63. data/lib/toji/recipe/ingredient/koji.rb +0 -21
  64. data/lib/toji/recipe/ingredient/koji/actual.rb +0 -32
  65. data/lib/toji/recipe/ingredient/koji/actual_fermentable.rb +0 -17
  66. data/lib/toji/recipe/ingredient/koji/base.rb +0 -37
  67. data/lib/toji/recipe/ingredient/koji/expected.rb +0 -48
  68. data/lib/toji/recipe/ingredient/koji/expected_fermentable.rb +0 -17
  69. data/lib/toji/recipe/ingredient/rice.rb +0 -21
  70. data/lib/toji/recipe/ingredient/rice/actual.rb +0 -29
  71. data/lib/toji/recipe/ingredient/rice/actual_steamable.rb +0 -29
  72. data/lib/toji/recipe/ingredient/rice/base.rb +0 -51
  73. data/lib/toji/recipe/ingredient/rice/expected.rb +0 -43
  74. data/lib/toji/recipe/ingredient/rice/expected_steamable.rb +0 -31
  75. data/lib/toji/recipe/ingredient/yeast.rb +0 -21
  76. data/lib/toji/recipe/rice_rate.rb +0 -10
  77. data/lib/toji/recipe/rice_rate/base.rb +0 -21
  78. data/lib/toji/recipe/rice_rate/cooked.rb +0 -67
  79. data/lib/toji/recipe/rice_rate/steamed.rb +0 -30
  80. data/lib/toji/recipe/three_step_mashing.rb +0 -274
  81. data/lib/toji/recipe/yeast_rate.rb +0 -41
  82. data/lib/toji/schedule.rb +0 -11
  83. data/lib/toji/schedule/calendar.rb +0 -139
  84. data/lib/toji/schedule/date_interval_enumerator.rb +0 -45
  85. data/lib/toji/schedule/product.rb +0 -96
@@ -14,25 +14,25 @@
14
14
  " </script>\n",
15
15
  "\n",
16
16
  "\n",
17
- "<div id=\"e4facdce-5cc2-429a-beb7-84888b0c737b\" style=\"height: 100%; width: 100%;\"></div>\n",
17
+ "<div id=\"ca25fc4f-9f48-4d59-b769-4967c6f1b91f\" style=\"height: 100%; width: 100%;\"></div>\n",
18
18
  "\n",
19
19
  "<script>\n",
20
20
  " require(['plotly'], function(Plotly) { \n",
21
21
  "Plotly.newPlot(\n",
22
- " 'e4facdce-5cc2-429a-beb7-84888b0c737b',\n",
23
- " [{\"x\":[0,3600,86400,172800,172801,259200,259201,345600,345601,432000,518400,604800,691200,777600,864000,950400,1036800,1123200],\"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/01 00:00\",\"01/01 01:00\",\"01/02 00:00\",\"01/03 00:00\",\"01/03 00:00\",\"01/04 00:00\",\"01/04 00:00\",\"01/05 00:00\",\"01/05 00:00\",\"01/06 00:00\",\"01/07 00:00\",\"01/08 00:00\",\"01/09 00:00\",\"01/10 00:00\",\"01/11 00:00\",\"01/12 00:00\",\"01/13 00:00\",\"01/14 00:00\"],\"name\":\"temps\",\"line\":{\"shape\":\"linear\"}},{\"x\":[86400,172800,259200,345600,432000,518400,604800,691200,777600,864000,950400,1036800,1123200],\"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/02 00:00\",\"01/03 00:00\",\"01/04 00:00\",\"01/05 00:00\",\"01/06 00:00\",\"01/07 00:00\",\"01/08 00:00\",\"01/09 00:00\",\"01/10 00:00\",\"01/11 00:00\",\"01/12 00:00\",\"01/13 00:00\",\"01/14 00:00\"],\"name\":\"baume\",\"line\":{\"shape\":\"linear\"}},{\"x\":[0,3600,86400,172800,259200,345600,432000,518400,604800,691200,777600,864000,950400,1036800,1123200],\"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/01 00:00\",\"01/01 01:00\",\"01/02 00:00\",\"01/03 00:00\",\"01/04 00:00\",\"01/05 00:00\",\"01/06 00:00\",\"01/07 00:00\",\"01/08 00:00\",\"01/09 00:00\",\"01/10 00:00\",\"01/11 00:00\",\"01/12 00:00\",\"01/13 00:00\",\"01/14 00:00\"],\"name\":\"acid\",\"line\":{\"shape\":\"linear\"}}],\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,\"y\":12.0,\"xref\":\"x\",\"yref\":\"y\",\"text\":\"mizukoji\",\"showarrow\":true,\"arrowhead\":1,\"ax\":0,\"ay\":-40},{\"x\":3600,\"y\":20.0,\"xref\":\"x\",\"yref\":\"y\",\"text\":\"shikomi\",\"showarrow\":true,\"arrowhead\":1,\"ax\":0,\"ay\":-40},{\"x\":86400,\"y\":14.0,\"xref\":\"x\",\"yref\":\"y\",\"text\":\"utase\",\"showarrow\":true,\"arrowhead\":1,\"ax\":0,\"ay\":-40},{\"x\":777600,\"y\":20.0,\"xref\":\"x\",\"yref\":\"y\",\"text\":\"wake\",\"showarrow\":true,\"arrowhead\":1,\"ax\":0,\"ay\":-40}]},\n",
22
+ " 'ca25fc4f-9f48-4d59-b769-4967c6f1b91f',\n",
23
+ " [{\"x\":[0,3600,86400,172800,172801,259200,259201,345600,345601,432000,518400,604800,691200,777600,864000,950400,1036800,1123200],\"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/01 00:00\",\"01/01 01:00\",\"01/02 00:00\",\"01/03 00:00\",\"01/03 00:00\",\"01/04 00:00\",\"01/04 00:00\",\"01/05 00:00\",\"01/05 00:00\",\"01/06 00:00\",\"01/07 00:00\",\"01/08 00:00\",\"01/09 00:00\",\"01/10 00:00\",\"01/11 00:00\",\"01/12 00:00\",\"01/13 00:00\",\"01/14 00:00\"],\"name\":\"temps\",\"line\":{\"dash\":\"solid\",\"shape\":\"linear\"},\"marker\":{\"color\":\"#1f77b4\"}},{\"x\":[86400,172800,259200,345600,432000,518400,604800,691200,777600,864000,950400,1036800,1123200],\"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/02 00:00\",\"01/03 00:00\",\"01/04 00:00\",\"01/05 00:00\",\"01/06 00:00\",\"01/07 00:00\",\"01/08 00:00\",\"01/09 00:00\",\"01/10 00:00\",\"01/11 00:00\",\"01/12 00:00\",\"01/13 00:00\",\"01/14 00:00\"],\"name\":\"baume\",\"line\":{\"dash\":\"solid\",\"shape\":\"linear\"},\"marker\":{\"color\":\"#9467bd\"}},{\"x\":[0,3600,86400,172800,259200,345600,432000,518400,604800,691200,777600,864000,950400,1036800,1123200],\"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/01 00:00\",\"01/01 01:00\",\"01/02 00:00\",\"01/03 00:00\",\"01/04 00:00\",\"01/05 00:00\",\"01/06 00:00\",\"01/07 00:00\",\"01/08 00:00\",\"01/09 00:00\",\"01/10 00:00\",\"01/11 00:00\",\"01/12 00:00\",\"01/13 00:00\",\"01/14 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,\"y\":12.0,\"xref\":\"x\",\"yref\":\"y\",\"text\":\"水麹\",\"showarrow\":true,\"arrowhead\":1,\"ax\":0,\"ay\":-40},{\"x\":3600,\"y\":20.0,\"xref\":\"x\",\"yref\":\"y\",\"text\":\"仕込み\",\"showarrow\":true,\"arrowhead\":1,\"ax\":0,\"ay\":-40},{\"x\":86400,\"y\":14.0,\"xref\":\"x\",\"yref\":\"y\",\"text\":\"打瀬\",\"showarrow\":true,\"arrowhead\":1,\"ax\":0,\"ay\":-40},{\"x\":777600,\"y\":20.0,\"xref\":\"x\",\"yref\":\"y\",\"text\":\"分け\",\"showarrow\":true,\"arrowhead\":1,\"ax\":0,\"ay\":-40}]},\n",
25
25
  " {\"linkText\":\"Export to plot.ly\",\"showLink\":true}\n",
26
26
  ")\n",
27
27
  "\n",
28
28
  "window.addEventListener('resize', function() {\n",
29
- " Plotly.Plots.resize(document.getElementById('e4facdce-5cc2-429a-beb7-84888b0c737b'))\n",
29
+ " Plotly.Plots.resize(document.getElementById('ca25fc4f-9f48-4d59-b769-4967c6f1b91f'))\n",
30
30
  "})\n",
31
31
  " }) \n",
32
32
  "</script>"
33
33
  ],
34
34
  "text/plain": [
35
- "#<Plotly::Offline::HTML:0x00007fc8508d28c0 @id=\"e4facdce-5cc2-429a-beb7-84888b0c737b\", @data=[{:x=>[0, 3600, 86400, 172800, 172801, 259200, 259201, 345600, 345601, 432000, 518400, 604800, 691200, 777600, 864000, 950400, 1036800, 1123200], :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/01 00:00\", \"01/01 01:00\", \"01/02 00:00\", \"01/03 00:00\", \"01/03 00:00\", \"01/04 00:00\", \"01/04 00:00\", \"01/05 00:00\", \"01/05 00:00\", \"01/06 00:00\", \"01/07 00:00\", \"01/08 00:00\", \"01/09 00:00\", \"01/10 00:00\", \"01/11 00:00\", \"01/12 00:00\", \"01/13 00:00\", \"01/14 00:00\"], :name=>:temps, :line=>{:shape=>:linear}}, {:x=>[86400, 172800, 259200, 345600, 432000, 518400, 604800, 691200, 777600, 864000, 950400, 1036800, 1123200], :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/02 00:00\", \"01/03 00:00\", \"01/04 00:00\", \"01/05 00:00\", \"01/06 00:00\", \"01/07 00:00\", \"01/08 00:00\", \"01/09 00:00\", \"01/10 00:00\", \"01/11 00:00\", \"01/12 00:00\", \"01/13 00:00\", \"01/14 00:00\"], :name=>:baume, :line=>{:shape=>:linear}}, {:x=>[0, 3600, 86400, 172800, 259200, 345600, 432000, 518400, 604800, 691200, 777600, 864000, 950400, 1036800, 1123200], :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/01 00:00\", \"01/01 01:00\", \"01/02 00:00\", \"01/03 00:00\", \"01/04 00:00\", \"01/05 00:00\", \"01/06 00:00\", \"01/07 00:00\", \"01/08 00:00\", \"01/09 00:00\", \"01/10 00:00\", \"01/11 00:00\", \"01/12 00:00\", \"01/13 00:00\", \"01/14 00:00\"], :name=>:acid, :line=>{:shape=>:linear}}], @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, :y=>12.0, :xref=>\"x\", :yref=>\"y\", :text=>\"mizukoji\", :showarrow=>true, :arrowhead=>1, :ax=>0, :ay=>-40}, {:x=>3600, :y=>20.0, :xref=>\"x\", :yref=>\"y\", :text=>\"shikomi\", :showarrow=>true, :arrowhead=>1, :ax=>0, :ay=>-40}, {:x=>86400, :y=>14.0, :xref=>\"x\", :yref=>\"y\", :text=>\"utase\", :showarrow=>true, :arrowhead=>1, :ax=>0, :ay=>-40}, {:x=>777600, :y=>20.0, :xref=>\"x\", :yref=>\"y\", :text=>\"wake\", :showarrow=>true, :arrowhead=>1, :ax=>0, :ay=>-40}]}, @config={:linkText=>\"Export to plot.ly\", :showLink=>true}, @embedded=true>"
35
+ "#<Plotly::Offline::HTML:0x00007fbd321d3340 @id=\"ca25fc4f-9f48-4d59-b769-4967c6f1b91f\", @data=[{:x=>[0, 3600, 86400, 172800, 172801, 259200, 259201, 345600, 345601, 432000, 518400, 604800, 691200, 777600, 864000, 950400, 1036800, 1123200], :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/01 00:00\", \"01/01 01:00\", \"01/02 00:00\", \"01/03 00:00\", \"01/03 00:00\", \"01/04 00:00\", \"01/04 00:00\", \"01/05 00:00\", \"01/05 00:00\", \"01/06 00:00\", \"01/07 00:00\", \"01/08 00:00\", \"01/09 00:00\", \"01/10 00:00\", \"01/11 00:00\", \"01/12 00:00\", \"01/13 00:00\", \"01/14 00:00\"], :name=>\"temps\", :line=>{:dash=>:solid, :shape=>:linear}, :marker=>{:color=>\"#1f77b4\"}}, {:x=>[86400, 172800, 259200, 345600, 432000, 518400, 604800, 691200, 777600, 864000, 950400, 1036800, 1123200], :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/02 00:00\", \"01/03 00:00\", \"01/04 00:00\", \"01/05 00:00\", \"01/06 00:00\", \"01/07 00:00\", \"01/08 00:00\", \"01/09 00:00\", \"01/10 00:00\", \"01/11 00:00\", \"01/12 00:00\", \"01/13 00:00\", \"01/14 00:00\"], :name=>\"baume\", :line=>{:dash=>:solid, :shape=>:linear}, :marker=>{:color=>\"#9467bd\"}}, {:x=>[0, 3600, 86400, 172800, 259200, 345600, 432000, 518400, 604800, 691200, 777600, 864000, 950400, 1036800, 1123200], :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/01 00:00\", \"01/01 01:00\", \"01/02 00:00\", \"01/03 00:00\", \"01/04 00:00\", \"01/05 00:00\", \"01/06 00:00\", \"01/07 00:00\", \"01/08 00:00\", \"01/09 00:00\", \"01/10 00:00\", \"01/11 00:00\", \"01/12 00:00\", \"01/13 00:00\", \"01/14 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, :y=>12.0, :xref=>\"x\", :yref=>\"y\", :text=>\"水麹\", :showarrow=>true, :arrowhead=>1, :ax=>0, :ay=>-40}, {:x=>3600, :y=>20.0, :xref=>\"x\", :yref=>\"y\", :text=>\"仕込み\", :showarrow=>true, :arrowhead=>1, :ax=>0, :ay=>-40}, {:x=>86400, :y=>14.0, :xref=>\"x\", :yref=>\"y\", :text=>\"打瀬\", :showarrow=>true, :arrowhead=>1, :ax=>0, :ay=>-40}, {:x=>777600, :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
36
  ]
37
37
  },
38
38
  "metadata": {},
@@ -47,25 +47,25 @@
47
47
  " </script>\n",
48
48
  "\n",
49
49
  "\n",
50
- "<div id=\"28391cbf-0dc6-46d2-94a6-58fa710d7a25\" style=\"height: 100%; width: 100%;\"></div>\n",
50
+ "<div id=\"39a95aa5-e87a-4aa2-90e8-985682dfe72d\" style=\"height: 100%; width: 100%;\"></div>\n",
51
51
  "\n",
52
52
  "<script>\n",
53
53
  " require(['plotly'], function(Plotly) { \n",
54
54
  "Plotly.newPlot(\n",
55
- " '28391cbf-0dc6-46d2-94a6-58fa710d7a25',\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/01 00:00\",\"01/01 01:00\",\"01/02 00:00\",\"01/03 00:00\",\"01/04 00:00\",\"01/05 00:00\",\"01/06 00:00\",\"01/07 00:00\",\"01/08 00:00\",\"01/09 00:00\",\"01/10 00:00\",\"01/11 00:00\",\"01/12 00:00\",\"01/13 00:00\",\"01/14 00:00\"],[\"mizukoji\",\"shikomi\",\"utase\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"wake\",\"\",\"\",\"\",\"\"],[\"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],[\"\",\"\",\"\",\"daki\",\"daki\",\"daki\",\"anka\",\"anka\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]]}}],\n",
55
+ " '39a95aa5-e87a-4aa2-90e8-985682dfe72d',\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/01 00:00\",\"01/01 01:00\",\"01/02 00:00\",\"01/03 00:00\",\"01/04 00:00\",\"01/05 00:00\",\"01/06 00:00\",\"01/07 00:00\",\"01/08 00:00\",\"01/09 00:00\",\"01/10 00:00\",\"01/11 00:00\",\"01/12 00:00\",\"01/13 00:00\",\"01/14 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
57
  " {\"height\":650},\n",
58
58
  " {\"linkText\":\"Export to plot.ly\",\"showLink\":true}\n",
59
59
  ")\n",
60
60
  "\n",
61
61
  "window.addEventListener('resize', function() {\n",
62
- " Plotly.Plots.resize(document.getElementById('28391cbf-0dc6-46d2-94a6-58fa710d7a25'))\n",
62
+ " Plotly.Plots.resize(document.getElementById('39a95aa5-e87a-4aa2-90e8-985682dfe72d'))\n",
63
63
  "})\n",
64
64
  " }) \n",
65
65
  "</script>"
66
66
  ],
67
67
  "text/plain": [
68
- "#<Plotly::Offline::HTML:0x00007fc851122f98 @id=\"28391cbf-0dc6-46d2-94a6-58fa710d7a25\", @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/01 00:00\", \"01/01 01:00\", \"01/02 00:00\", \"01/03 00:00\", \"01/04 00:00\", \"01/05 00:00\", \"01/06 00:00\", \"01/07 00:00\", \"01/08 00:00\", \"01/09 00:00\", \"01/10 00:00\", \"01/11 00:00\", \"01/12 00:00\", \"01/13 00:00\", \"01/14 00:00\"], [\"mizukoji\", \"shikomi\", \"utase\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"wake\", \"\", \"\", \"\", \"\"], [\"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], [\"\", \"\", \"\", \"daki\", \"daki\", \"daki\", \"anka\", \"anka\", \"\", \"\", \"\", \"\", \"\", \"\", \"\"]]}}], @layout={:height=>650}, @config={:linkText=>\"Export to plot.ly\", :showLink=>true}, @embedded=true>"
68
+ "#<Plotly::Offline::HTML:0x00007fbd311ee038 @id=\"39a95aa5-e87a-4aa2-90e8-985682dfe72d\", @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/01 00:00\", \"01/01 01:00\", \"01/02 00:00\", \"01/03 00:00\", \"01/04 00:00\", \"01/05 00:00\", \"01/06 00:00\", \"01/07 00:00\", \"01/08 00:00\", \"01/09 00:00\", \"01/10 00:00\", \"01/11 00:00\", \"01/12 00:00\", \"01/13 00:00\", \"01/14 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
69
  ]
70
70
  },
71
71
  "metadata": {},
@@ -74,7 +74,7 @@
74
74
  {
75
75
  "data": {
76
76
  "text/plain": [
77
- "#<CZTop::Socket::PUB:0x7fc852545c30 last_endpoint=\"tcp://127.0.0.1:53318\">"
77
+ "#<CZTop::Socket::PUB:0x7fbd35a2a560 last_endpoint=\"tcp://127.0.0.1:56600\">"
78
78
  ]
79
79
  },
80
80
  "execution_count": 1,
@@ -85,9 +85,10 @@
85
85
  "source": [
86
86
  "$LOAD_PATH << File.dirname(__FILE__) + \"/../lib\"\n",
87
87
  "require 'toji'\n",
88
+ "require './example_core'\n",
88
89
  "require 'rbplotly'\n",
89
90
  "\n",
90
- "shubo = Toji::Brew::Shubo.load_yaml_file(\"shubo.yaml\")\n",
91
+ "shubo = Example::Brew::Shubo.load_yaml_file(\"shubo.yaml\")\n",
91
92
  "shubo.progress.plot.show\n",
92
93
  "shubo.progress.table.tap {|t|\n",
93
94
  " t.layout.height = 650\n",
@@ -104,7 +105,7 @@
104
105
  ],
105
106
  "metadata": {
106
107
  "kernelspec": {
107
- "display_name": "Ruby 2.7.0",
108
+ "display_name": "Ruby 2.7.1",
108
109
  "language": "ruby",
109
110
  "name": "ruby"
110
111
  },
@@ -1,7 +1,8 @@
1
1
  require 'toji'
2
+ require_relative 'example_core'
2
3
  require 'terminal-table'
3
4
 
4
- shubo = Toji::Brew::Shubo.load_yaml_file("shubo.yaml")
5
+ shubo = Example::Brew::Shubo.load_yaml_file(File.dirname(__FILE__)+"/shubo.yaml")
5
6
 
6
7
  table = Terminal::Table.new do |t|
7
8
  t << ["作業", "日数", "品温(度)", "ボーメ", "酸度", "経過時間", "日時"]
@@ -1,15 +1,15 @@
1
1
  date_line: 0
2
- records:
2
+ states:
3
3
  - elapsed_time: 0
4
- mark: :mizukoji
4
+ mark: 水麹
5
5
  temps: 12.0
6
6
  acid: 13.0
7
7
  - elapsed_time: 3600
8
- mark: :shikomi
8
+ mark: 仕込み
9
9
  temps: 20.0
10
10
  acid: 13.0
11
11
  - elapsed_time: 86400
12
- mark: :utase
12
+ mark: 打瀬
13
13
  temps: 14.0
14
14
  baume: 15.0
15
15
  acid: 13.0
@@ -19,31 +19,31 @@ records:
19
19
  - 11.0
20
20
  baume: 16.0
21
21
  acid: 13.0
22
- warmings: :daki
22
+ warmings: 暖気
23
23
  - elapsed_time: 259200
24
24
  temps:
25
25
  - 10.0
26
26
  - 13.0
27
27
  baume: 16.5
28
28
  acid: 13.5
29
- warmings: :daki
29
+ warmings: 暖気
30
30
  - elapsed_time: 345600
31
31
  temps:
32
32
  - 12.0
33
33
  - 15.0
34
34
  baume: 17.0
35
35
  acid: 13.5
36
- warmings: :daki
36
+ warmings: 暖気
37
37
  - elapsed_time: 432000
38
38
  temps: 14.0
39
39
  baume: 17.0
40
40
  acid: 14.0
41
- warmings: :anka
41
+ warmings: 行火
42
42
  - elapsed_time: 518400
43
43
  temps: 20.0
44
44
  baume: 17.0
45
45
  acid: 14.5
46
- warmings: :anka
46
+ warmings: 行火
47
47
  - elapsed_time: 604800
48
48
  temps: 20.0
49
49
  baume: 14.0
@@ -53,7 +53,7 @@ records:
53
53
  baume: 12.0
54
54
  acid: 16.0
55
55
  - elapsed_time: 777600
56
- mark: :wake
56
+ mark: 分け
57
57
  temps: 20.0
58
58
  baume: 9.0
59
59
  acid: 16.0
@@ -2,9 +2,11 @@ require "toji/version"
2
2
  require 'active_support/all'
3
3
  require 'yaml'
4
4
 
5
+ require 'toji/ingredient'
5
6
  require 'toji/recipe'
6
7
  require 'toji/brew'
7
- require 'toji/schedule'
8
+ require 'toji/calendar'
9
+ require 'toji/product'
8
10
 
9
11
  module Toji
10
12
  class Error < StandardError; end
@@ -5,10 +5,9 @@ module Toji
5
5
  end
6
6
  end
7
7
 
8
- require 'toji/brew/state_accessor'
9
8
  require 'toji/brew/base'
9
+ require 'toji/brew/state_wrapper'
10
10
  require 'toji/brew/state'
11
- require 'toji/brew/state_record'
12
11
  require 'toji/brew/builder'
13
12
  require 'toji/brew/graph'
14
13
 
@@ -2,7 +2,6 @@ module Toji
2
2
  module Brew
3
3
  class Base
4
4
  include Enumerable
5
- extend StateAccessor
6
5
 
7
6
  REQUIRED_KEYS = [
8
7
  :time,
@@ -30,48 +29,14 @@ module Toji
30
29
  :note,
31
30
  ].freeze
32
31
 
33
- attr_reader :day_offset
34
- attr_reader :min_time
32
+ attr_accessor :states
33
+ attr_accessor :day_offset
34
+ attr_accessor :min_time
35
35
 
36
- def initialize(records, date_line)
37
- @date_line = date_line
38
- self.records = records
39
- end
40
-
41
- def records=(records)
42
- records = records.map{|r| StateRecord.create(r)}
43
- min_time = records.map(&:time).compact.sort.first
44
- @states = records.map{|r| State.new(r.elapsed_time, r, self)}
45
-
46
- # time
47
- if min_time
48
- @states.each {|s|
49
- if s.record.time
50
- s.elapsed_time = (s.record.time - min_time).to_i
51
- s.time = s.record.time
52
- else
53
- #s.elapsed_time = s.record.elapsed_time
54
- s.time = min_time + s.record.elapsed_time
55
- end
56
- }
57
- end
58
- @min_time = @states.first&.time
59
-
60
- @states = @states.sort{|a,b| a.elapsed_time<=>b.elapsed_time}
61
-
62
- # day_offset
63
- t = @states.first&.time
36
+ def initialize
37
+ @states = []
64
38
  @day_offset = 0
65
- if t
66
- @day_offset = t - Time.mktime(t.year, t.month, t.day)
67
- end
68
- @day_offset = (((24 - @date_line) * HOUR) + @day_offset) % DAY
69
-
70
- # mark hash
71
- @hash = {}
72
- @states.select{|s| s.record.mark}.each {|s|
73
- @hash[s.record.mark] = s
74
- }
39
+ @min_time = 0
75
40
  end
76
41
 
77
42
  def days
@@ -86,20 +51,12 @@ module Toji
86
51
  nil
87
52
  end
88
53
 
89
- def [](mark)
90
- @hash[mark]
91
- end
92
-
93
- def states
94
- @states.clone.freeze
95
- end
96
-
97
54
  def each(&block)
98
55
  @states.each(&block)
99
56
  end
100
57
 
101
58
  def has_keys
102
- result = REQUIRED_KEYS.clone
59
+ result = REQUIRED_KEYS.dup
103
60
 
104
61
  result += OPTIONAL_KEYS.select {|k|
105
62
  @states.find {|s| s.send(k).present?}
@@ -116,30 +73,9 @@ module Toji
116
73
  }
117
74
  end
118
75
 
119
- def self.create(records, date_line: 0)
120
- if Base===records
121
- records
122
- else
123
- builder.add(records).date_line(date_line).build
124
- end
125
- end
126
-
127
76
  def self.builder
128
77
  Builder.new(self)
129
78
  end
130
-
131
- def self.load_hash(hash)
132
- hash = hash.deep_symbolize_keys
133
- date_line = hash[:date_line] || 0
134
- records = hash[:records] || []
135
-
136
- builder.add(records).date_line(date_line).build
137
- end
138
-
139
- def self.load_yaml_file(fname)
140
- hash = YAML.load_file(fname)
141
- load_hash(hash)
142
- end
143
79
  end
144
80
  end
145
81
  end
@@ -4,12 +4,15 @@ module Toji
4
4
 
5
5
  def initialize(cls)
6
6
  @cls = cls
7
- @records = []
7
+ @states = []
8
8
  @date_line = 0
9
+ @prefix_day_labels = nil
9
10
  end
10
11
 
11
- def <<(record)
12
- @records += [record].flatten
12
+ def <<(state)
13
+ @states += [state].flatten.map {|state|
14
+ State.create(state)
15
+ }
13
16
  self
14
17
  end
15
18
  alias_method :add, :<<
@@ -19,8 +22,48 @@ module Toji
19
22
  self
20
23
  end
21
24
 
25
+ def prefix_day_labels(val)
26
+ @prefix_day_labels = val
27
+ self
28
+ end
29
+
22
30
  def build
23
- @cls.new(@records, @date_line)
31
+ brew = @cls.new
32
+
33
+ min_time = @states.map(&:time).compact.sort.first
34
+ wrappers = @states.map{|r| StateWrapper.new(r.elapsed_time, r, brew)}
35
+
36
+ # time
37
+ if min_time
38
+ wrappers.each {|w|
39
+ if w.state.time
40
+ w.elapsed_time = (w.state.time - min_time).to_i
41
+ w.time = w.state.time
42
+ else
43
+ #w.elapsed_time = w.state.elapsed_time
44
+ w.time = min_time + w.state.elapsed_time
45
+ end
46
+ }
47
+ end
48
+ min_time = wrappers.first&.time
49
+
50
+ wrappers = wrappers.sort{|a,b| a.elapsed_time<=>b.elapsed_time}
51
+
52
+ # day_offset
53
+ t = wrappers.first&.time
54
+ day_offset = 0
55
+ if t
56
+ day_offset = t - Time.mktime(t.year, t.month, t.day)
57
+ end
58
+ day_offset = (((24 - @date_line) * HOUR) + day_offset) % DAY
59
+
60
+ brew.states = wrappers
61
+ brew.day_offset = day_offset
62
+ brew.min_time = min_time
63
+ if Moromi===brew
64
+ brew.prefix_day_labels = @prefix_day_labels
65
+ end
66
+ brew
24
67
  end
25
68
  end
26
69
  end
@@ -5,7 +5,6 @@ module Toji
5
5
 
6
6
  def initialize
7
7
  @actuals = []
8
- @expects = []
9
8
  end
10
9
 
11
10
  def actual(moromi, name=:actual)
@@ -100,7 +100,7 @@ module Toji
100
100
  end
101
101
 
102
102
  def annotations
103
- return [] if @enable_annotations
103
+ return [] if !@enable_annotations
104
104
 
105
105
  @brew.select{|s| s.mark}.map {|s|
106
106
  {
@@ -2,16 +2,6 @@ module Toji
2
2
  module Brew
3
3
  class Koji < Base
4
4
 
5
- state_reader :hikikomi
6
- state_reader :tokomomi
7
- state_reader :kirikaeshi
8
- state_reader :mori
9
- state_reader :naka_shigoto
10
- state_reader :shimai_shigoto
11
- state_reader :tsumikae
12
- state_reader :dekoji
13
-
14
-
15
5
  def progress(name: nil, dash: :solid, enable_annotations: true)
16
6
  Graph::Progress.new(self, name: name, dash: dash, enable_annotations: enable_annotations)
17
7
  end
@@ -2,41 +2,7 @@ module Toji
2
2
  module Brew
3
3
  class Moromi < Base
4
4
 
5
- state_reader :moto
6
- state_reader :soe
7
- state_reader :naka
8
- state_reader :tome
9
- state_reader :yodan
10
-
11
- attr_writer :prefix_day_labels
12
-
13
- def prefix_day_labels
14
- if @prefix_day_labels
15
- @prefix_day_labels
16
- elsif !self[:soe] && !self[:tome]
17
- nil
18
- else
19
- labels = []
20
- [:soe, :naka, :tome].each {|mark|
21
- s = self[mark]
22
- if s
23
- i = s.day - 1
24
- labels[i] = mark
25
- end
26
- }
27
-
28
- soe_i = labels.index(:soe)
29
- labels.map.with_index {|label,i|
30
- if label
31
- label
32
- elsif !soe_i || i<soe_i
33
- :moto
34
- else
35
- :odori
36
- end
37
- }
38
- end
39
- end
5
+ attr_accessor :prefix_day_labels
40
6
 
41
7
  def moromi_tome_day
42
8
  prefix_day_labels&.length
@@ -57,7 +23,7 @@ module Toji
57
23
  if _prefix
58
24
  _prefix + moromi_days.times.map{|i| i+2}.map(&:to_s)
59
25
  else
60
- self.days.times.map{|i| i+1}.map(&:to_s)
26
+ super
61
27
  end
62
28
  end
63
29