toji 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/example/koji_recipe.rb +34 -0
- data/example/make_koji.rb +18 -0
- data/example/rice_recipe.rb +28 -0
- data/example/three_step_mashing_recipe.rb +65 -0
- data/lib/toji.rb +12 -0
- data/lib/toji/graph.rb +6 -0
- data/lib/toji/graph/ab.rb +75 -0
- data/lib/toji/ingredient.rb +8 -0
- data/lib/toji/ingredient/koji.rb +19 -0
- data/lib/toji/ingredient/koji/actual.rb +21 -0
- data/lib/toji/ingredient/koji/actual_fermentable.rb +15 -0
- data/lib/toji/ingredient/koji/base.rb +26 -0
- data/lib/toji/ingredient/koji/expected.rb +51 -0
- data/lib/toji/ingredient/koji/expected_fermentable.rb +15 -0
- data/lib/toji/ingredient/rice.rb +19 -0
- data/lib/toji/ingredient/rice/actual.rb +18 -0
- data/lib/toji/ingredient/rice/actual_steamable.rb +27 -0
- data/lib/toji/ingredient/rice/base.rb +40 -0
- data/lib/toji/ingredient/rice/expected.rb +46 -0
- data/lib/toji/ingredient/rice/expected_steamable.rb +29 -0
- data/lib/toji/ingredient/yeast.rb +9 -0
- data/lib/toji/ingredient/yeast/base.rb +21 -0
- data/lib/toji/ingredient/yeast/red_star.rb +30 -0
- data/lib/toji/progress.rb +11 -0
- data/lib/toji/progress/job.rb +165 -0
- data/lib/toji/progress/job_accessor.rb +13 -0
- data/lib/toji/progress/jobs.rb +142 -0
- data/lib/toji/progress/make_koji.rb +100 -0
- data/lib/toji/progress/moromi.rb +276 -0
- data/lib/toji/progress/shubo.rb +158 -0
- data/lib/toji/recipe.rb +9 -0
- data/lib/toji/recipe/koji_rate.rb +16 -0
- data/lib/toji/recipe/rice_rate.rb +10 -0
- data/lib/toji/recipe/rice_rate/base.rb +21 -0
- data/lib/toji/recipe/rice_rate/cooked.rb +61 -0
- data/lib/toji/recipe/rice_rate/steamed.rb +42 -0
- data/lib/toji/recipe/step.rb +65 -0
- data/lib/toji/recipe/three_step_mashing.rb +87 -0
- data/lib/toji/version.rb +3 -0
- data/toji.gemspec +36 -0
- metadata +178 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0fd2eacf273ed8b0126f4d78775c0b0f3d152b54cdba00cf15abe221b71baeb8
|
4
|
+
data.tar.gz: 5ad7bca85b2b46dd33ec59a5b0069612dd3cdf325fdd6404db2d9dab594f4edf
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 46c4cc2b892fc477dc7b63d01fbd75f2b5cc934d749e97b9b858820410a958d0545cf024008ad4649aa7270a0e8c2f067b667a92f2d5c3befe3643ea9da70985
|
7
|
+
data.tar.gz: 572a7438670c646a0dc93bb056a3d55e19bd7bfad5004922544cd87d8c78f8d59d2c36c5de479afe00ea9e250a8f80266d6258f7f44a8216b8c1ebfaecdcecac
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 yoshida
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Toji
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/toji`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'toji'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install toji
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/toji.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "toji"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'toji'
|
2
|
+
require 'terminal-table'
|
3
|
+
|
4
|
+
koji = Toji::Ingredient::Koji.expected(100, rice_rate: Toji::Recipe::RiceRate::Steamed::DEFAULT, koji_rate: Toji::Recipe::KojiRate::DEFAULT)
|
5
|
+
|
6
|
+
table = Terminal::Table.new do |t|
|
7
|
+
t << ["", "分量", "白米を基準とした歩合"]
|
8
|
+
t << :separator
|
9
|
+
t << ["麹", koji.dekoji, 1.0 + koji.dekoji_rate]
|
10
|
+
t << [" 蒸米", koji.steamed, 1.0 + koji.steamed_rate]
|
11
|
+
t << [" 白米", koji.raw, 1.0]
|
12
|
+
t << [" 汲水", koji.soaking_water, koji.soaked_rate]
|
13
|
+
t << [" 種麹", koji.tanekoji, koji.tanekoji_rate]
|
14
|
+
end
|
15
|
+
puts table
|
16
|
+
puts
|
17
|
+
|
18
|
+
table = Terminal::Table.new do |t|
|
19
|
+
t << ["工程", "原料", "分量"]
|
20
|
+
t << :separator
|
21
|
+
t << ["洗米・浸漬", "白米", koji.raw]
|
22
|
+
t << ["", "吸水増加量", koji.soaking_water]
|
23
|
+
t << :separator
|
24
|
+
t << ["水切り", "浸漬米", koji.soaked]
|
25
|
+
t << ["", "蒸発・炊飯前の汲水", koji.steaming_water]
|
26
|
+
t << :separator
|
27
|
+
t << ["蒸し", "蒸米", koji.steamed]
|
28
|
+
t << :separator
|
29
|
+
t << ["放冷・引込み", "蒸米", koji.cooled]
|
30
|
+
t << ["", "種麹", koji.tanekoji]
|
31
|
+
t << :separator
|
32
|
+
t << ["製麹", "麹", koji.dekoji]
|
33
|
+
end
|
34
|
+
puts table
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'toji'
|
2
|
+
require 'terminal-table'
|
3
|
+
|
4
|
+
make_koji = Toji::Progress::MakeKoji.template
|
5
|
+
|
6
|
+
table = Terminal::Table.new do |t|
|
7
|
+
t << ["作業", "品温(度)", "操作室温", "乾湿差(度)", "経過時間"]
|
8
|
+
t << :separator
|
9
|
+
make_koji.jobs.each {|j|
|
10
|
+
if j.before_temp && j.after_temp
|
11
|
+
temp = "%s / %s" % [j.before_temp, j.after_temp]
|
12
|
+
else
|
13
|
+
temp = j.before_temp || j.after_temp
|
14
|
+
end
|
15
|
+
t << [j.id, temp, j.room_temp, j.room_psychrometry, j.elapsed_time]
|
16
|
+
}
|
17
|
+
end
|
18
|
+
puts table
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'toji'
|
2
|
+
require 'terminal-table'
|
3
|
+
|
4
|
+
#rice = Toji::Ingredient::Rice.expected(100, rice_rate: Toji::Recipe::RiceRate::Steamed::DEFAULT)
|
5
|
+
rice = Toji::Ingredient::Rice.expected(100, rice_rate: Toji::Recipe::RiceRate::Cooked::DEFAULT)
|
6
|
+
|
7
|
+
table = Terminal::Table.new do |t|
|
8
|
+
t << ["", "分量", "白米を基準とした歩合"]
|
9
|
+
t << :separator
|
10
|
+
t << ["蒸米", rice.steamed, 1.0 + rice.steamed_rate]
|
11
|
+
t << [" 白米", rice.raw, 1.0]
|
12
|
+
t << [" 汲水", rice.soaking_water, rice.soaked_rate]
|
13
|
+
end
|
14
|
+
puts table
|
15
|
+
puts
|
16
|
+
|
17
|
+
table = Terminal::Table.new do |t|
|
18
|
+
t << ["工程", "原料", "分量"]
|
19
|
+
t << :separator
|
20
|
+
t << ["洗米・浸漬", "白米", rice.raw]
|
21
|
+
t << ["", "吸水増加量", rice.soaking_water]
|
22
|
+
t << :separator
|
23
|
+
t << ["水切り", "浸漬米", rice.soaked]
|
24
|
+
t << ["", "蒸発・炊飯前の汲水", rice.steaming_water]
|
25
|
+
t << :separator
|
26
|
+
t << ["蒸し", "蒸米", rice.steamed]
|
27
|
+
end
|
28
|
+
puts table
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'toji'
|
2
|
+
require 'terminal-table'
|
3
|
+
|
4
|
+
recipe = Toji::Recipe::ThreeStepMashing.new(Toji::Ingredient::Yeast::RedStar, 2000)
|
5
|
+
|
6
|
+
table = Terminal::Table.new do |t|
|
7
|
+
t << [""] + recipe.class::STEP_NAMES
|
8
|
+
t << :separator
|
9
|
+
t << ["[原料]"]
|
10
|
+
t << ["酵母(g)", recipe.yeast.yeast]
|
11
|
+
t << ["酵母吸水", recipe.yeast.water]
|
12
|
+
t << ["乳酸(ml)"]
|
13
|
+
t << ["掛米(g)"] + recipe.steps.map(&:rice).map(&:raw)
|
14
|
+
t << ["麹米(g)"] + recipe.steps.map(&:koji).map(&:raw)
|
15
|
+
t << ["汲水(ml)"] + recipe.steps.map(&:water)
|
16
|
+
t << :separator
|
17
|
+
t << ["[合計]"]
|
18
|
+
t << ["総米(g)"] + recipe.steps.map(&:rice_total)
|
19
|
+
t << ["麹歩合(%)"] + recipe.steps.map{|s| s.koji_rate * 100}
|
20
|
+
t << ["汲水歩合(%)"] + recipe.steps.map{|s| s.water_rate * 100}
|
21
|
+
t << :separator
|
22
|
+
t << ["[累計]"]
|
23
|
+
t << ["総米(g)"] + recipe.cumulative_rice_totals
|
24
|
+
t << ["白米比率"] + recipe.rice_rates
|
25
|
+
t << ["酒母歩合(%)"] + recipe.cumulative_shubo_rates.map{|s| s * 100}
|
26
|
+
t << ["タンク内容量(ml)"] + recipe.cumulative_weight_totals
|
27
|
+
end
|
28
|
+
puts table
|
29
|
+
puts
|
30
|
+
|
31
|
+
|
32
|
+
puts "掛米"
|
33
|
+
table = Terminal::Table.new do |t|
|
34
|
+
t << ["工程", "原料"] + recipe.class::STEP_NAMES
|
35
|
+
t << :separator
|
36
|
+
t << ["洗米・浸漬", "白米(g)"] + recipe.steps.map(&:rice).map(&:raw)
|
37
|
+
t << ["", "吸水増加量(ml)"] + recipe.steps.map(&:rice).map(&:soaking_water)
|
38
|
+
t << :separator
|
39
|
+
t << ["水切り", "浸漬米(g)"] + recipe.steps.map(&:rice).map(&:soaked)
|
40
|
+
t << ["", "汲水(ml)"] + recipe.steps.map(&:rice).map(&:steaming_water)
|
41
|
+
t << :separator
|
42
|
+
t << ["蒸し", "蒸米(g)"] + recipe.steps.map(&:rice).map(&:steamed)
|
43
|
+
end
|
44
|
+
puts table
|
45
|
+
puts
|
46
|
+
|
47
|
+
puts "麹"
|
48
|
+
table = Terminal::Table.new do |t|
|
49
|
+
t << ["工程", "原料"] + recipe.class::STEP_NAMES
|
50
|
+
t << :separator
|
51
|
+
t << ["洗米・浸漬", "白米(g)"] + recipe.steps.map(&:koji).map(&:raw)
|
52
|
+
t << ["", "吸水増加量(ml)"] + recipe.steps.map(&:koji).map(&:soaking_water)
|
53
|
+
t << :separator
|
54
|
+
t << ["水切り", "浸漬米(g)"] + recipe.steps.map(&:koji).map(&:soaked)
|
55
|
+
t << ["", "汲水(ml)"] + recipe.steps.map(&:koji).map(&:steaming_water)
|
56
|
+
t << :separator
|
57
|
+
t << ["蒸し", "蒸米(g)"] + recipe.steps.map(&:koji).map(&:steamed)
|
58
|
+
t << :separator
|
59
|
+
t << ["放冷・引込み", "蒸米(g)"] + recipe.steps.map(&:koji).map(&:cooled)
|
60
|
+
t << ["", "種麹(g)"] + recipe.steps.map(&:koji).map(&:tanekoji)
|
61
|
+
t << :separator
|
62
|
+
t << ["製麹", "麹(g)"] + recipe.steps.map(&:koji).map(&:dekoji)
|
63
|
+
end
|
64
|
+
puts table
|
65
|
+
puts
|
data/lib/toji.rb
ADDED
data/lib/toji/graph.rb
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
module Toji
|
2
|
+
module Graph
|
3
|
+
class Ab
|
4
|
+
attr_reader :coef
|
5
|
+
|
6
|
+
def initialize(coef=1.5)
|
7
|
+
@coef = coef
|
8
|
+
@actuals = []
|
9
|
+
@expects = []
|
10
|
+
end
|
11
|
+
|
12
|
+
def actual(jobs, name=:actual)
|
13
|
+
data = jobs.map{|j| [j.time || j.elapsed_time + jobs.day_offset, j.alcohol, j.baume]}.select{|a| a[1] && a[2]}
|
14
|
+
xs = data.map{|a| a[1]}
|
15
|
+
ys = data.map{|a| a[2]}
|
16
|
+
texts = data.map{|a| "%s<br />alc=%s, be=%s" % a}
|
17
|
+
@actuals << {x: xs, y: ys, text: texts, name: name}
|
18
|
+
|
19
|
+
self
|
20
|
+
end
|
21
|
+
|
22
|
+
def expect(alcohol, nihonshudo)
|
23
|
+
@expects << [alcohol.to_f, nihonshudo.to_f]
|
24
|
+
|
25
|
+
self
|
26
|
+
end
|
27
|
+
|
28
|
+
def data
|
29
|
+
result = []
|
30
|
+
|
31
|
+
@actuals.each {|a|
|
32
|
+
result << a
|
33
|
+
}
|
34
|
+
|
35
|
+
@expects.each {|alcohol, nihonshudo|
|
36
|
+
ys = [0.0, 8.0]
|
37
|
+
xs = ys.map{|b| alcohol - (b - nihonshudo * -0.1) * @coef}
|
38
|
+
|
39
|
+
name = "%s%s %s" % [nihonshudo<0 ? "" : "+", nihonshudo, alcohol]
|
40
|
+
|
41
|
+
result << {x: xs, y: ys, name: name}
|
42
|
+
}
|
43
|
+
|
44
|
+
result
|
45
|
+
end
|
46
|
+
|
47
|
+
def plot
|
48
|
+
d = data
|
49
|
+
|
50
|
+
#min_baume = d.map{|h| h[:y].min}.min || 0
|
51
|
+
#min_baume = [min_baume-1, 0].min
|
52
|
+
min_baume = 0
|
53
|
+
|
54
|
+
max_baume = d.map{|h| h[:y].max}.max || 0
|
55
|
+
max_baume = [max_baume+1, 10].max
|
56
|
+
|
57
|
+
Plotly::Plot.new(
|
58
|
+
data: d,
|
59
|
+
layout: {
|
60
|
+
xaxis: {
|
61
|
+
title: "Alcohol",
|
62
|
+
dtick: 2,
|
63
|
+
range: [0, 20],
|
64
|
+
},
|
65
|
+
yaxis: {
|
66
|
+
title: "Baume",
|
67
|
+
dtick: 1,
|
68
|
+
range: [min_baume, max_baume],
|
69
|
+
}
|
70
|
+
}
|
71
|
+
)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'toji/ingredient/koji/base'
|
2
|
+
require 'toji/ingredient/koji/expected_fermentable'
|
3
|
+
require 'toji/ingredient/koji/expected'
|
4
|
+
require 'toji/ingredient/koji/actual_fermentable'
|
5
|
+
require 'toji/ingredient/koji/actual'
|
6
|
+
|
7
|
+
module Toji
|
8
|
+
module Ingredient
|
9
|
+
module Koji
|
10
|
+
def self.expected(raw, rice_rate: Recipe::RiceRate::Cooked::DEFAULT, koji_rate: Recipe::KojiRate::DEFAULT)
|
11
|
+
Expected.new(raw, rice_rate: rice_rate, koji_rate: koji_rate)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.actual(raw, soaked, steaming_water, steamed, cooled, tanekoji, dekoji)
|
15
|
+
Actual.new(raw, soaked, steaming_water, steamed, cooled, tanekoji, dekoji)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Toji
|
2
|
+
module Ingredient
|
3
|
+
module Koji
|
4
|
+
class Actual
|
5
|
+
include Base
|
6
|
+
include Rice::ActualSteamable
|
7
|
+
include ActualFermentable
|
8
|
+
|
9
|
+
def initialize(raw, soaked, steaming_water, steamed, cooled, tanekoji, dekoji)
|
10
|
+
@raw = raw
|
11
|
+
@soaked = soaked
|
12
|
+
@steaming_water = steaming_water
|
13
|
+
@steamed = steamed
|
14
|
+
@cooled = cooled
|
15
|
+
@tanekoji = tanekoji
|
16
|
+
@dekoji = dekoji
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|