gravitheque 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +4 -1
- data/Gemfile +2 -2
- data/README.md +15 -0
- data/bin/test +0 -2
- data/gravitheque.gemspec +1 -1
- data/lib/calculators/mash.rb +51 -0
- data/test/calculators/test_mash.rb +27 -0
- data/test/test_helper.rb +9 -2
- metadata +98 -51
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -8,7 +8,6 @@ end
|
|
8
8
|
group :documentation do
|
9
9
|
gem "github-markup"
|
10
10
|
gem "redcarpet", "~> 1.0"
|
11
|
-
gem "yard"
|
12
11
|
end
|
13
12
|
|
14
13
|
group :mac do
|
@@ -17,5 +16,6 @@ group :mac do
|
|
17
16
|
end
|
18
17
|
|
19
18
|
group :test do
|
20
|
-
gem "simplecov"
|
19
|
+
gem "simplecov", :platforms => [:mri, :jruby]
|
20
|
+
gem "yard", :platforms => [:mri, :jruby]
|
21
21
|
end
|
data/README.md
CHANGED
@@ -96,6 +96,18 @@ Calculate.ibus({ :extract => 18.5, :at => 60, :alpha => 6.5, :mass => 56, :volum
|
|
96
96
|
Calculate.ibus({ :extract => 1.055, :at => 60, :alpha => 6.5, :mass => 2, :volume => 5 }, { :extract => :specific_gravity, :mass => :ounces, :volume => :gallons })
|
97
97
|
```
|
98
98
|
|
99
|
+
### Mash
|
100
|
+
|
101
|
+
```ruby
|
102
|
+
require "calculators/mash"
|
103
|
+
|
104
|
+
Calculate.strike_temperature 1.5, 20, 75
|
105
|
+
Calculate.strike_temperature 1.25, 65, 154, :us
|
106
|
+
|
107
|
+
Calculate.infusion_volume 1, 40, 60, 3.6, 3.6
|
108
|
+
Calculate.infusion_volume 1, 104, 140, 8, 8, :us
|
109
|
+
```
|
110
|
+
|
99
111
|
### Yeast
|
100
112
|
|
101
113
|
```ruby
|
@@ -122,6 +134,9 @@ Convert.terminal_brix_to_terminal_gravity 16.2, 7.8
|
|
122
134
|
Convert.plato_to_specific_gravity 16
|
123
135
|
|
124
136
|
Convert.specific_gravity_to_plato 1.055
|
137
|
+
|
138
|
+
Convert.specific_gravity_to_temperature_corrected_gravity 1.045, 160
|
139
|
+
Convert.specific_gravity_to_temperature_corrected_gravity 1.028, 50, :celsius
|
125
140
|
```
|
126
141
|
|
127
142
|
### Mass
|
data/bin/test
CHANGED
data/gravitheque.gemspec
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
module Calculate
|
2
|
+
|
3
|
+
# Calculate temperature of strike water for dough in.
|
4
|
+
#
|
5
|
+
# @example
|
6
|
+
# Calculate.strike_temperature 1.5, 20, 68
|
7
|
+
# Calculate.strike_temperature 1.5, 70, 154, :us
|
8
|
+
#
|
9
|
+
# @param [Float] ratio water to grain ratio; e.g. 1.5 liters per kilogram
|
10
|
+
# @param [Fixnum] initial temperature of grains
|
11
|
+
# @param [Fixnum] target mash temperature
|
12
|
+
# @param [Symbol] units change units of measure to U.S. customary
|
13
|
+
# @return [Fixnum] strike water temperature
|
14
|
+
def self.strike_temperature ratio, initial, target, units = :metric
|
15
|
+
constant = case units
|
16
|
+
when :metric then 0.41
|
17
|
+
when :us then 0.2
|
18
|
+
else raise ArgumentError, "Units must be one of :metric or :us"
|
19
|
+
end
|
20
|
+
|
21
|
+
((constant / ratio) * (target - initial) + target).round
|
22
|
+
end
|
23
|
+
|
24
|
+
# Calculate volume of boiling infusion water needed to increase mash temperature.
|
25
|
+
#
|
26
|
+
# @example
|
27
|
+
# Calculate.infusion_volume 1.5, 20, 68, 3.6, 4.3
|
28
|
+
# Calculate.infusion_volume 1.5, 70, 154, 8, 9.6, :us
|
29
|
+
#
|
30
|
+
# @param [Float] ratio water to grain ratio; e.g. 1.5 liters per kilogram
|
31
|
+
# @param [Fixnum] initial temperature of mash
|
32
|
+
# @param [Fixnum] target mash temperature
|
33
|
+
# @param [Float] mass weight of grain in the mash
|
34
|
+
# @param [Float] volume amount of water already in the mash
|
35
|
+
# @param [Symbol] units change units of measure to U.S. customary
|
36
|
+
# @return [Fixnum] infusion water volume
|
37
|
+
def self.infusion_volume ratio, initial, target, mass, volume, units = :metric
|
38
|
+
case units
|
39
|
+
when :metric
|
40
|
+
boiling = 100
|
41
|
+
constant = 0.41
|
42
|
+
when :us
|
43
|
+
boiling = 212
|
44
|
+
constant = 0.2
|
45
|
+
else raise ArgumentError, "Units must be one of :metric or :us"
|
46
|
+
end
|
47
|
+
|
48
|
+
((target - initial) * ((constant * mass) + volume) / (boiling - target)).round 1
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "./test/test_helper"
|
2
|
+
require "calculators/mash"
|
3
|
+
|
4
|
+
describe Calculate do
|
5
|
+
|
6
|
+
it "must calculate strike temperature using E.U. measures" do
|
7
|
+
(Calculate.strike_temperature 1.5, 21, 40).must_equal 45
|
8
|
+
end
|
9
|
+
|
10
|
+
it "must calculate strike temperature using U.S. measures" do
|
11
|
+
(Calculate.strike_temperature 1.5, 70, 104, :us).must_equal 109
|
12
|
+
end
|
13
|
+
|
14
|
+
it "must calculate infusion volume using E.U. measures" do
|
15
|
+
(Calculate.infusion_volume 1, 40, 60, 3.6, 3.6).must_equal 2.5
|
16
|
+
end
|
17
|
+
|
18
|
+
it "must calculate infusion volume using U.S. measures" do
|
19
|
+
(Calculate.infusion_volume 1, 104, 140, 8, 8, :us).must_equal 4.8
|
20
|
+
end
|
21
|
+
|
22
|
+
it "must raise and exception when given an unknown unit" do
|
23
|
+
lambda { Calculate.strike_temperature 1, 1, 1, :imperial }.must_raise ArgumentError
|
24
|
+
lambda { Calculate.infusion_volume 1, 1, 1, 1, 1, :imperial }.must_raise ArgumentError
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -4,12 +4,19 @@ unless RUBY_DESCRIPTION =~ /rubinius/i
|
|
4
4
|
|
5
5
|
class SimpleCov::Formatter::NoHTMLFormatter
|
6
6
|
def format result
|
7
|
-
puts "\n#{result.
|
7
|
+
puts "\n#{result.covered_percent.round}% test coverage"
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
SimpleCov.start do
|
12
|
-
@formatter = SimpleCov::Formatter::NoHTMLFormatter
|
12
|
+
@formatter = ENV["CI"] ? SimpleCov::Formatter::NoHTMLFormatter : SimpleCov::Formatter::HTMLFormatter
|
13
|
+
end
|
14
|
+
|
15
|
+
yard_stats = `yard stats --list-undoc 2>&1`
|
16
|
+
if yard_stats =~ /100.00%/
|
17
|
+
puts "100% documentation coverage\n\n"
|
18
|
+
else
|
19
|
+
puts yard_stats
|
13
20
|
end
|
14
21
|
end
|
15
22
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gravitheque
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
prerelease:
|
5
|
+
version: 0.3.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- john muhl
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-27 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Tools for brewers.
|
15
15
|
email:
|
@@ -18,67 +18,114 @@ executables: []
|
|
18
18
|
extensions: []
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
|
-
-
|
22
|
-
|
23
|
-
-
|
24
|
-
|
25
|
-
-
|
26
|
-
|
27
|
-
-
|
28
|
-
|
29
|
-
-
|
30
|
-
|
31
|
-
-
|
32
|
-
|
33
|
-
-
|
34
|
-
|
35
|
-
-
|
36
|
-
|
37
|
-
-
|
38
|
-
|
39
|
-
-
|
40
|
-
|
41
|
-
-
|
42
|
-
|
43
|
-
-
|
44
|
-
|
45
|
-
-
|
46
|
-
|
47
|
-
-
|
48
|
-
|
49
|
-
-
|
21
|
+
- !binary |-
|
22
|
+
LmdpdGlnbm9yZQ==
|
23
|
+
- !binary |-
|
24
|
+
LnRyYXZpcy55bWw=
|
25
|
+
- !binary |-
|
26
|
+
LnlhcmRvcHRz
|
27
|
+
- !binary |-
|
28
|
+
R2VtZmlsZQ==
|
29
|
+
- !binary |-
|
30
|
+
R3VhcmRmaWxl
|
31
|
+
- !binary |-
|
32
|
+
TElDRU5TRQ==
|
33
|
+
- !binary |-
|
34
|
+
UkVBRE1FLm1k
|
35
|
+
- !binary |-
|
36
|
+
YmluL3Rlc3Q=
|
37
|
+
- !binary |-
|
38
|
+
Z3Jhdml0aGVxdWUuZ2Vtc3BlYw==
|
39
|
+
- !binary |-
|
40
|
+
bGliL2NhbGN1bGF0b3JzLnJi
|
41
|
+
- !binary |-
|
42
|
+
bGliL2NhbGN1bGF0b3JzL2FsY29ob2wucmI=
|
43
|
+
- !binary |-
|
44
|
+
bGliL2NhbGN1bGF0b3JzL2NhbG9yaWVzLnJi
|
45
|
+
- !binary |-
|
46
|
+
bGliL2NhbGN1bGF0b3JzL2hvcHMucmI=
|
47
|
+
- !binary |-
|
48
|
+
bGliL2NhbGN1bGF0b3JzL21hc2gucmI=
|
49
|
+
- !binary |-
|
50
|
+
bGliL2NhbGN1bGF0b3JzL3llYXN0LnJi
|
51
|
+
- !binary |-
|
52
|
+
bGliL2NvbnZlcnNpb25zLnJi
|
53
|
+
- !binary |-
|
54
|
+
bGliL2NvbnZlcnNpb25zL2V4dHJhY3QucmI=
|
55
|
+
- !binary |-
|
56
|
+
bGliL2NvbnZlcnNpb25zL21hc3MucmI=
|
57
|
+
- !binary |-
|
58
|
+
bGliL2NvbnZlcnNpb25zL3RlbXBlcmF0dXJlLnJi
|
59
|
+
- !binary |-
|
60
|
+
bGliL2NvbnZlcnNpb25zL3ZvbHVtZS5yYg==
|
61
|
+
- !binary |-
|
62
|
+
bGliL2dyYXZpdGhlcXVlLnJi
|
63
|
+
- !binary |-
|
64
|
+
dGVzdC9jYWxjdWxhdG9ycy90ZXN0X2FsY29ob2wucmI=
|
65
|
+
- !binary |-
|
66
|
+
dGVzdC9jYWxjdWxhdG9ycy90ZXN0X2NhbG9yaWVzLnJi
|
67
|
+
- !binary |-
|
68
|
+
dGVzdC9jYWxjdWxhdG9ycy90ZXN0X2hvcHMucmI=
|
69
|
+
- !binary |-
|
70
|
+
dGVzdC9jYWxjdWxhdG9ycy90ZXN0X21hc2gucmI=
|
71
|
+
- !binary |-
|
72
|
+
dGVzdC9jYWxjdWxhdG9ycy90ZXN0X3llYXN0LnJi
|
73
|
+
- !binary |-
|
74
|
+
dGVzdC9jb252ZXJzaW9ucy90ZXN0X2V4dHJhY3QucmI=
|
75
|
+
- !binary |-
|
76
|
+
dGVzdC9jb252ZXJzaW9ucy90ZXN0X21hc3MucmI=
|
77
|
+
- !binary |-
|
78
|
+
dGVzdC9jb252ZXJzaW9ucy90ZXN0X3RlbXBlcmF0dXJlLnJi
|
79
|
+
- !binary |-
|
80
|
+
dGVzdC9jb252ZXJzaW9ucy90ZXN0X3ZvbHVtZS5yYg==
|
81
|
+
- !binary |-
|
82
|
+
dGVzdC90ZXN0X2hlbHBlci5yYg==
|
50
83
|
homepage: http://gravitheque.herokuapp.com/
|
51
84
|
licenses: []
|
52
|
-
post_install_message:
|
85
|
+
post_install_message:
|
53
86
|
rdoc_options: []
|
54
87
|
require_paths:
|
55
88
|
- lib
|
56
89
|
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
90
|
requirements:
|
59
91
|
- - ! '>='
|
60
92
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
62
|
-
|
93
|
+
version: !binary |-
|
94
|
+
MA==
|
63
95
|
none: false
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
97
|
requirements:
|
65
98
|
- - ! '>='
|
66
99
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
100
|
+
version: !binary |-
|
101
|
+
MA==
|
102
|
+
none: false
|
68
103
|
requirements: []
|
69
|
-
rubyforge_project:
|
70
|
-
rubygems_version: 1.8.
|
71
|
-
signing_key:
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 1.8.13
|
106
|
+
signing_key:
|
72
107
|
specification_version: 3
|
73
108
|
summary: The library that will eventually power the web application of the same name.
|
74
109
|
test_files:
|
75
|
-
-
|
76
|
-
|
77
|
-
-
|
78
|
-
|
79
|
-
-
|
80
|
-
|
81
|
-
-
|
82
|
-
|
83
|
-
-
|
84
|
-
|
110
|
+
- !binary |-
|
111
|
+
dGVzdC9jYWxjdWxhdG9ycy90ZXN0X2FsY29ob2wucmI=
|
112
|
+
- !binary |-
|
113
|
+
dGVzdC9jYWxjdWxhdG9ycy90ZXN0X2NhbG9yaWVzLnJi
|
114
|
+
- !binary |-
|
115
|
+
dGVzdC9jYWxjdWxhdG9ycy90ZXN0X2hvcHMucmI=
|
116
|
+
- !binary |-
|
117
|
+
dGVzdC9jYWxjdWxhdG9ycy90ZXN0X21hc2gucmI=
|
118
|
+
- !binary |-
|
119
|
+
dGVzdC9jYWxjdWxhdG9ycy90ZXN0X3llYXN0LnJi
|
120
|
+
- !binary |-
|
121
|
+
dGVzdC9jb252ZXJzaW9ucy90ZXN0X2V4dHJhY3QucmI=
|
122
|
+
- !binary |-
|
123
|
+
dGVzdC9jb252ZXJzaW9ucy90ZXN0X21hc3MucmI=
|
124
|
+
- !binary |-
|
125
|
+
dGVzdC9jb252ZXJzaW9ucy90ZXN0X3RlbXBlcmF0dXJlLnJi
|
126
|
+
- !binary |-
|
127
|
+
dGVzdC9jb252ZXJzaW9ucy90ZXN0X3ZvbHVtZS5yYg==
|
128
|
+
- !binary |-
|
129
|
+
dGVzdC90ZXN0X2hlbHBlci5yYg==
|
130
|
+
has_rdoc:
|
131
|
+
...
|