beercalc 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/beercalc.rb +11 -0
  2. metadata +2 -2
@@ -182,4 +182,15 @@ class Beercalc
182
182
  end
183
183
  return addition
184
184
  end
185
+
186
+ ## GRAVITY TEMPERATURE CORRECTION
187
+ # param temp: number - Temperature in Fahrenheit
188
+ # param g: number - Gravity from the hydrometer reading
189
+ def self.gravityCorrection(temp, g)
190
+ unless !temp.is_a?(Numeric) || !g.is_a?(Numeric)
191
+ correction = ((1.313454 - 0.132674*temp + 2.057793*10**-3*temp**2 - 2.627634*10**-6*temp**3) * 0.001) + g
192
+ else
193
+ correction = nil
194
+ end
195
+ end
185
196
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beercalc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-01 00:00:00.000000000 Z
12
+ date: 2013-11-19 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Common beer calculations for brewers.
15
15
  email: griffith.ben@gmail.com