brewscribe 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/CHANGELOG.md +7 -0
- data/brewscribe.gemspec +1 -0
- data/lib/brewscribe/ingredient_list.rb +1 -1
- data/lib/brewscribe/recipe.rb +26 -0
- data/lib/brewscribe/version.rb +1 -1
- data/spec/recipe_spec.rb +31 -22
- data/spec/spec_helper.rb +1 -0
- metadata +56 -15
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## 0.3.0, released 2013-03-08
|
|
2
|
+
|
|
3
|
+
* Added ABV/ABW calculation methods to Brewscribe::Recipe
|
|
4
|
+
* Added SRM calculation method to Brewscribe::Recipe
|
|
5
|
+
* Added IBU calculation method to Brewscribe::Recipe
|
|
6
|
+
* Fixed typo
|
|
7
|
+
|
|
1
8
|
## 0.2.0, released 2012-04-13
|
|
2
9
|
|
|
3
10
|
* Added Brewscribe::Mash
|
data/brewscribe.gemspec
CHANGED
data/lib/brewscribe/recipe.rb
CHANGED
|
@@ -61,5 +61,31 @@ module Brewscribe
|
|
|
61
61
|
self.carb = Carbonation.from_data self.carb
|
|
62
62
|
self.style = Style.from_data self.style
|
|
63
63
|
end
|
|
64
|
+
|
|
65
|
+
def abv
|
|
66
|
+
(((1.05 * (self.og_measured - self.fg_measured)) / self.fg_measured) / 0.79 * 100).round(2)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def abw
|
|
70
|
+
abv * 0.79336
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def ibu
|
|
74
|
+
ibus = self.ingredients.hops.inject(0) do |sum, hop|
|
|
75
|
+
sum + hop.ibu_contrib
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
(ibus * 1000).round(1)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def srm
|
|
82
|
+
volume_in_gallons = volume_measured / 128.0
|
|
83
|
+
mcu = ingredients.grains.inject(0.0) do |sum, grain|
|
|
84
|
+
grain_in_pounds = grain.amount / 16.0
|
|
85
|
+
sum + ((grain.color * grain_in_pounds) / volume_in_gallons)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
(1.4922 * (mcu ** 0.6859)).round(1)
|
|
89
|
+
end
|
|
64
90
|
end
|
|
65
91
|
end
|
data/lib/brewscribe/version.rb
CHANGED
data/spec/recipe_spec.rb
CHANGED
|
@@ -29,28 +29,28 @@ describe Brewscribe::Recipe do
|
|
|
29
29
|
subject.ingredients.should be_a Brewscribe::IngredientList
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
32
|
+
its(:boil_vol_measured) { should be_a Float }
|
|
33
|
+
its(:carb_vols) { should be_a Float }
|
|
34
|
+
its(:desired_ibu) {should be_a Float }
|
|
35
|
+
its(:desired_color) { should be_a Float }
|
|
36
|
+
its(:desired_og) { should be_a Float }
|
|
37
|
+
its(:fg_measured) { should be_a Float }
|
|
38
|
+
its(:mash_ph) { should be_a Float }
|
|
39
|
+
its(:og_boil_measured) { should be_a Float }
|
|
40
|
+
its(:og_measured) { should be_a Float }
|
|
41
|
+
its(:og_primary) { should be_a Float }
|
|
42
|
+
its(:og_secondary) { should be_a Float }
|
|
43
|
+
its(:old_boil_vol) { should be_a Float }
|
|
44
|
+
its(:old_efficiency) { should be_a Float }
|
|
45
|
+
its(:running_gravity) { should be_a Float }
|
|
46
|
+
its(:runoff_ph) { should be_a Float }
|
|
47
|
+
its(:starter_size) { should be_a Float }
|
|
48
|
+
its(:rating) { should be_a Float }
|
|
49
|
+
its(:version) { should be_a Float }
|
|
50
|
+
its(:volume_measured) { should be_a Float }
|
|
51
|
+
its(:date) { should be_a Date }
|
|
52
|
+
its(:inv_date) { should be_a Date }
|
|
53
|
+
its(:last_modified) { should be_a Date }
|
|
54
54
|
|
|
55
55
|
it 'should set the type to one of the TYPES' do
|
|
56
56
|
Brewscribe::Recipe::TYPES.should include subject.type
|
|
@@ -71,4 +71,13 @@ describe Brewscribe::Recipe do
|
|
|
71
71
|
it 'should set stir_plate to boolean' do
|
|
72
72
|
[true, false].should include subject.stir_plate
|
|
73
73
|
end
|
|
74
|
+
|
|
75
|
+
context 'calculation methods' do
|
|
76
|
+
its(:og_measured) { should == 1.046 }
|
|
77
|
+
its(:fg_measured) { should == 1.010 }
|
|
78
|
+
its(:abv) { should == 4.74 }
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
its(:ibu) { should == 65.1 }
|
|
82
|
+
its(:srm) { should == 30.6 }
|
|
74
83
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: brewscribe
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,11 +9,11 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2013-03-08 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rspec
|
|
16
|
-
requirement:
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ! '>='
|
|
@@ -21,10 +21,15 @@ dependencies:
|
|
|
21
21
|
version: '0'
|
|
22
22
|
type: :development
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements:
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
26
|
+
requirements:
|
|
27
|
+
- - ! '>='
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '0'
|
|
25
30
|
- !ruby/object:Gem::Dependency
|
|
26
31
|
name: guard
|
|
27
|
-
requirement:
|
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
|
28
33
|
none: false
|
|
29
34
|
requirements:
|
|
30
35
|
- - ! '>='
|
|
@@ -32,10 +37,15 @@ dependencies:
|
|
|
32
37
|
version: '0'
|
|
33
38
|
type: :development
|
|
34
39
|
prerelease: false
|
|
35
|
-
version_requirements:
|
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
42
|
+
requirements:
|
|
43
|
+
- - ! '>='
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '0'
|
|
36
46
|
- !ruby/object:Gem::Dependency
|
|
37
47
|
name: guard-rspec
|
|
38
|
-
requirement:
|
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
|
39
49
|
none: false
|
|
40
50
|
requirements:
|
|
41
51
|
- - ! '>='
|
|
@@ -43,10 +53,31 @@ dependencies:
|
|
|
43
53
|
version: '0'
|
|
44
54
|
type: :development
|
|
45
55
|
prerelease: false
|
|
46
|
-
version_requirements:
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
none: false
|
|
58
|
+
requirements:
|
|
59
|
+
- - ! '>='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
47
62
|
- !ruby/object:Gem::Dependency
|
|
48
63
|
name: rake
|
|
49
|
-
requirement:
|
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
|
65
|
+
none: false
|
|
66
|
+
requirements:
|
|
67
|
+
- - ! '>='
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: '0'
|
|
70
|
+
type: :development
|
|
71
|
+
prerelease: false
|
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
+
none: false
|
|
74
|
+
requirements:
|
|
75
|
+
- - ! '>='
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: '0'
|
|
78
|
+
- !ruby/object:Gem::Dependency
|
|
79
|
+
name: pry
|
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
|
50
81
|
none: false
|
|
51
82
|
requirements:
|
|
52
83
|
- - ! '>='
|
|
@@ -54,10 +85,15 @@ dependencies:
|
|
|
54
85
|
version: '0'
|
|
55
86
|
type: :development
|
|
56
87
|
prerelease: false
|
|
57
|
-
version_requirements:
|
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
89
|
+
none: false
|
|
90
|
+
requirements:
|
|
91
|
+
- - ! '>='
|
|
92
|
+
- !ruby/object:Gem::Version
|
|
93
|
+
version: '0'
|
|
58
94
|
- !ruby/object:Gem::Dependency
|
|
59
95
|
name: nokogiri
|
|
60
|
-
requirement:
|
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
|
61
97
|
none: false
|
|
62
98
|
requirements:
|
|
63
99
|
- - ! '>='
|
|
@@ -65,7 +101,12 @@ dependencies:
|
|
|
65
101
|
version: '0'
|
|
66
102
|
type: :runtime
|
|
67
103
|
prerelease: false
|
|
68
|
-
version_requirements:
|
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
105
|
+
none: false
|
|
106
|
+
requirements:
|
|
107
|
+
- - ! '>='
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: '0'
|
|
69
110
|
description:
|
|
70
111
|
email:
|
|
71
112
|
- cadwallion@gmail.com
|
|
@@ -127,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
127
168
|
version: '0'
|
|
128
169
|
segments:
|
|
129
170
|
- 0
|
|
130
|
-
hash:
|
|
171
|
+
hash: 1203638230809629989
|
|
131
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
173
|
none: false
|
|
133
174
|
requirements:
|
|
@@ -136,10 +177,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
136
177
|
version: '0'
|
|
137
178
|
segments:
|
|
138
179
|
- 0
|
|
139
|
-
hash:
|
|
180
|
+
hash: 1203638230809629989
|
|
140
181
|
requirements: []
|
|
141
182
|
rubyforge_project:
|
|
142
|
-
rubygems_version: 1.8.
|
|
183
|
+
rubygems_version: 1.8.24
|
|
143
184
|
signing_key:
|
|
144
185
|
specification_version: 3
|
|
145
186
|
summary: A Beersmith (.bsmx) file parser
|