gravitheque 0.2.0 → 0.3.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.
data/.travis.yml CHANGED
@@ -1,8 +1,11 @@
1
1
  rvm:
2
2
  - 1.9.3
3
- - jruby-19mode
3
+ - jruby-head
4
4
  - rbx-19mode
5
5
 
6
6
  script: bin/test
7
7
 
8
+ env:
9
+ - JRUBY_OPTS="--1.9"
10
+
8
11
  bundler_args: --without development documentation mac
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
@@ -1,7 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "./test/test_helper"
4
-
5
3
  tests = Dir.glob "test/**/*.rb"
6
4
  tests.each { |test| require File.expand_path test }
7
5
 
data/gravitheque.gemspec CHANGED
@@ -11,5 +11,5 @@ Gem::Specification.new do |gem|
11
11
  gem.test_files = `git ls-files -- test/*`.split("\n")
12
12
  gem.name = "gravitheque"
13
13
  gem.require_paths = ["lib"]
14
- gem.version = "0.2.0"
14
+ gem.version = "0.3.0"
15
15
  end
@@ -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.covered_lines} of #{result.total_lines} LOC tested (#{result.covered_percent.round(2)}%)"
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
- version: 0.2.0
5
- prerelease:
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-24 00:00:00.000000000 Z
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
- - .gitignore
22
- - .travis.yml
23
- - .yardopts
24
- - Gemfile
25
- - Guardfile
26
- - LICENSE
27
- - README.md
28
- - bin/test
29
- - gravitheque.gemspec
30
- - lib/calculators.rb
31
- - lib/calculators/alcohol.rb
32
- - lib/calculators/calories.rb
33
- - lib/calculators/hops.rb
34
- - lib/calculators/yeast.rb
35
- - lib/conversions.rb
36
- - lib/conversions/extract.rb
37
- - lib/conversions/mass.rb
38
- - lib/conversions/temperature.rb
39
- - lib/conversions/volume.rb
40
- - lib/gravitheque.rb
41
- - test/calculators/test_alcohol.rb
42
- - test/calculators/test_calories.rb
43
- - test/calculators/test_hops.rb
44
- - test/calculators/test_yeast.rb
45
- - test/conversions/test_extract.rb
46
- - test/conversions/test_mass.rb
47
- - test/conversions/test_temperature.rb
48
- - test/conversions/test_volume.rb
49
- - test/test_helper.rb
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: '0'
62
- required_rubygems_version: !ruby/object:Gem::Requirement
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: '0'
100
+ version: !binary |-
101
+ MA==
102
+ none: false
68
103
  requirements: []
69
- rubyforge_project:
70
- rubygems_version: 1.8.15
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
- - test/calculators/test_alcohol.rb
76
- - test/calculators/test_calories.rb
77
- - test/calculators/test_hops.rb
78
- - test/calculators/test_yeast.rb
79
- - test/conversions/test_extract.rb
80
- - test/conversions/test_mass.rb
81
- - test/conversions/test_temperature.rb
82
- - test/conversions/test_volume.rb
83
- - test/test_helper.rb
84
- has_rdoc:
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
+ ...