beer_recipe 0.4.5 → 0.4.6
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.
- checksums.yaml +4 -4
- data/lib/beer_recipe/formula.rb +19 -0
- data/lib/beer_recipe/hop_wrapper.rb +10 -3
- data/lib/beer_recipe/misc_wrapper.rb +26 -7
- data/lib/beer_recipe/recipe_wrapper.rb +1 -1
- data/lib/beer_recipe/text_formatter.rb +9 -1
- data/lib/beer_recipe/version.rb +1 -1
- data/locales/en.yml +4 -0
- data/locales/se.yml +4 -0
- data/template/exalted_beer.html.erb +30 -30
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0274207975de94cb136bd8ede50212079c49fffb
|
4
|
+
data.tar.gz: e79e0f6a9fa1a10fa50c0f6ac93b17f298264c9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43e266ccd63eb887abd9b76617609ceebf3c435d002e6db2547a48fa209d21d00f2eaad5758f7b7c9c7f21568b8fa7b5151374c3f302252f1a9e20f849397f52
|
7
|
+
data.tar.gz: 54d86c3c5e50dab7138b038a553c6ed89663c9d8c2079aa9cb765b2981ce64715ff6687b39170bfe9136f65dcc19d216b093bf24050ee99a4492d8e500fbe92a
|
data/lib/beer_recipe/formula.rb
CHANGED
@@ -48,6 +48,25 @@ module BeerRecipe
|
|
48
48
|
q = (-205.35 * (fg ** 2)) + (668.72 * fg) - 463.37
|
49
49
|
(0.1808 * p) + (0.8192 * q)
|
50
50
|
end
|
51
|
+
|
52
|
+
def tinseth(batch_size, boil_time, og, alpha, amount)
|
53
|
+
# Bigness factor = 1.65 * 0.000125^(wort gravity - 1)
|
54
|
+
# Boil Time factor = 1 - e^(-0.04 * time in mins) / 4.15
|
55
|
+
# Decimal Alpha Acid Utilization = Bigness Factor * Boil Time Factor
|
56
|
+
# mg/l of added alpha acids = (decimal AA rating * grams hops * 1000) / liters of wort
|
57
|
+
# IBUs = decimal alpha acid utilization * mg/l of added alpha acids
|
58
|
+
decimal_aa_rating = alpha / 100
|
59
|
+
bigness_factor = 1.65 * ( 0.000125 ** (og - 1) )
|
60
|
+
boil_time_factor = (1 - Math::E ** ( -0.04 * boil_time ) ) / 4.15
|
61
|
+
alpha_acid_utilization = bigness_factor * boil_time_factor
|
62
|
+
added_alpha_acids = (decimal_aa_rating * amount * 1000) / batch_size
|
63
|
+
ibus = alpha_acid_utilization * added_alpha_acids
|
64
|
+
return ibus
|
65
|
+
end
|
66
|
+
|
67
|
+
def mgl_added_alpha_acids(batch_size, alpha, amount)
|
68
|
+
(alpha * amount * 1000) / batch_size
|
69
|
+
end
|
51
70
|
end
|
52
71
|
end
|
53
72
|
|
@@ -1,13 +1,20 @@
|
|
1
1
|
class BeerRecipe::HopWrapper < BeerRecipe::Wrapper
|
2
|
-
attr_accessor :ibu
|
3
2
|
|
4
3
|
def amount
|
5
4
|
@record.amount * 1000
|
6
5
|
end
|
7
6
|
|
7
|
+
def aau
|
8
|
+
@record.alpha * amount * 0.035274
|
9
|
+
end
|
10
|
+
|
11
|
+
# mg/l of added alpha acids
|
12
|
+
def mgl_added_alpha_acids
|
13
|
+
BeerRecipe::Formula.new.mgl_added_alpha_acids(@recipe.batch_size, @record.alpha, amount)
|
14
|
+
end
|
15
|
+
|
8
16
|
def ibu
|
9
|
-
|
10
|
-
( @record.alpha * amount * boil_time * 3 ) / @recipe.batch_size
|
17
|
+
@ibu ||= BeerRecipe::Formula.new.tinseth(@recipe.batch_size, @record.time, @recipe.og, @record.alpha, amount)
|
11
18
|
end
|
12
19
|
|
13
20
|
def dryhop?
|
@@ -1,26 +1,45 @@
|
|
1
1
|
class BeerRecipe::MiscWrapper < BeerRecipe::Wrapper
|
2
|
+
DAY = 1440
|
3
|
+
|
4
|
+
def weight?
|
5
|
+
amount_is_weight
|
6
|
+
end
|
7
|
+
|
8
|
+
def days?
|
9
|
+
time > DAY
|
10
|
+
end
|
11
|
+
|
12
|
+
def large_amount?
|
13
|
+
amount >= 1
|
14
|
+
end
|
15
|
+
|
2
16
|
def unit
|
3
|
-
|
4
|
-
|
17
|
+
# maybe use display_amount directly instead
|
18
|
+
if weight?
|
19
|
+
large_amount? ? 'kilograms' : 'grams'
|
5
20
|
else
|
6
|
-
'ml'
|
21
|
+
large_amount? ? 'items' : 'ml'
|
7
22
|
end
|
8
23
|
end
|
9
24
|
|
10
25
|
def formatted_amount
|
11
|
-
|
26
|
+
if large_amount?
|
27
|
+
"#{'%.0f' % amount}"
|
28
|
+
else
|
29
|
+
"#{'%.0f' % (1000 * amount)}"
|
30
|
+
end
|
12
31
|
end
|
13
32
|
|
14
33
|
def formatted_time
|
15
|
-
t = if
|
16
|
-
"#{'%.0f' % (time /
|
34
|
+
t = if days?
|
35
|
+
"#{'%.0f' % (time / DAY)}"
|
17
36
|
else
|
18
37
|
"#{'%.0f' % time}"
|
19
38
|
end
|
20
39
|
end
|
21
40
|
|
22
41
|
def time_unit
|
23
|
-
if
|
42
|
+
if days?
|
24
43
|
'days'
|
25
44
|
else
|
26
45
|
'minutes'
|
@@ -8,7 +8,7 @@ class BeerRecipe::TextFormatter < BeerRecipe::RecipeFormatter
|
|
8
8
|
puts "OG: #{@recipe.og}"
|
9
9
|
puts "FG: #{@recipe.fg}"
|
10
10
|
puts "ABV: #{'%.2f' % @recipe.abv}%"
|
11
|
-
puts "IBU: #{@recipe.ibu}"
|
11
|
+
puts "IBU: #{'%.0f' % @recipe.ibu}"
|
12
12
|
end
|
13
13
|
|
14
14
|
def format_mash(mash)
|
@@ -38,6 +38,14 @@ class BeerRecipe::TextFormatter < BeerRecipe::RecipeFormatter
|
|
38
38
|
puts "#{h.formatted_amount}\t#{h.name} (#{h.form})\t#{h.use}\t#{h.formatted_time}\t#{h.formatted_ibu}"
|
39
39
|
end
|
40
40
|
|
41
|
+
def before_miscs
|
42
|
+
puts "\nMiscellaneous:"
|
43
|
+
end
|
44
|
+
|
45
|
+
def format_misc(m)
|
46
|
+
puts "#{m.name}\t#{m.formatted_amount} #{m.unit}\t#{m.formatted_time} #{m.time_unit}"
|
47
|
+
end
|
48
|
+
|
41
49
|
def before_yeasts
|
42
50
|
puts "\nYeasts:"
|
43
51
|
end
|
data/lib/beer_recipe/version.rb
CHANGED
data/locales/en.yml
CHANGED
@@ -88,6 +88,7 @@ Fining: Fining
|
|
88
88
|
Herb: Herb
|
89
89
|
Spice: Spice
|
90
90
|
Flavor: Flavor
|
91
|
+
Water Agent: Water Agent
|
91
92
|
Other: Other
|
92
93
|
Secondary: Secondary
|
93
94
|
Yeast Nutrient: Yeast Nutrient
|
@@ -95,3 +96,6 @@ Ginger Root: Ginger Root
|
|
95
96
|
Fermentation: Fermentation
|
96
97
|
Coffee: Coffee
|
97
98
|
Seeds of Paradise: Seeds of Paradise
|
99
|
+
items: items
|
100
|
+
Primary: Primary
|
101
|
+
Bottling: Bottling
|
data/locales/se.yml
CHANGED
@@ -87,6 +87,7 @@ Fining: Klarning
|
|
87
87
|
Herb: Ört
|
88
88
|
Spice: Krydda
|
89
89
|
Flavor: Smak
|
90
|
+
Water Agent: Vattenjustering
|
90
91
|
Other: Övrigt
|
91
92
|
Secondary: Sekundär
|
92
93
|
Yeast Nutrient: Jästnäring
|
@@ -94,3 +95,6 @@ Ginger Root: Ingefära
|
|
94
95
|
Fermentation: Jäsning
|
95
96
|
Coffee: Kaffe
|
96
97
|
Seeds of Paradise: Paradisfrön
|
98
|
+
items: stycken
|
99
|
+
Primary: Primär
|
100
|
+
Bottling: Buteljering
|
@@ -223,36 +223,6 @@
|
|
223
223
|
</table>
|
224
224
|
</section>
|
225
225
|
|
226
|
-
<% if miscs.count > 0 %>
|
227
|
-
<section class="recipe_miscs">
|
228
|
-
<h2><%= I18n.t(:miscs) %></h2>
|
229
|
-
<table>
|
230
|
-
<thead>
|
231
|
-
<tr>
|
232
|
-
<th><%= I18n.t(:misc_name) %></th>
|
233
|
-
<th><%= I18n.t(:misc_amount) %></th>
|
234
|
-
<th><%= I18n.t(:misc_type) %></th>
|
235
|
-
<th><%= I18n.t(:misc_use) %></th>
|
236
|
-
<th><%= I18n.t(:misc_time) %></th>
|
237
|
-
</tr>
|
238
|
-
</thead>
|
239
|
-
<tbody>
|
240
|
-
<% miscs.each do |m| %>
|
241
|
-
<meta itemprop="recipeIngredient"
|
242
|
-
content="<%= m.formatted_amount %> <%= I18n.t(m.unit, default: m.unit) %> <%= m.name %>">
|
243
|
-
<tr>
|
244
|
-
<td class="misc_name"><%= I18n.t(m.name, default: m.name) %></td>
|
245
|
-
<td class="misc_amount format_number"><%= m.formatted_amount %> <%= I18n.t(m.unit, default: m.unit) %></td>
|
246
|
-
<td class="misc_type"><%= I18n.t(m.type, default: m.type) %></td>
|
247
|
-
<td class="misc_use"><%= I18n.t(m.use, default: m.use) %></td>
|
248
|
-
<td class="misc_time"><%= m.formatted_time %> <%= I18n.t(m.time_unit, default: m.time_unit) %></td>
|
249
|
-
</tr>
|
250
|
-
<% end %>
|
251
|
-
</tbody>
|
252
|
-
</table>
|
253
|
-
</section>
|
254
|
-
<% end %>
|
255
|
-
|
256
226
|
<section class="recipe_hops">
|
257
227
|
<h2><%= I18n.t(:hops) %></h2>
|
258
228
|
<table>
|
@@ -287,6 +257,36 @@
|
|
287
257
|
</table>
|
288
258
|
</section>
|
289
259
|
|
260
|
+
<% if miscs.count > 0 %>
|
261
|
+
<section class="recipe_miscs">
|
262
|
+
<h2><%= I18n.t(:miscs) %></h2>
|
263
|
+
<table>
|
264
|
+
<thead>
|
265
|
+
<tr>
|
266
|
+
<th><%= I18n.t(:misc_name) %></th>
|
267
|
+
<th><%= I18n.t(:misc_amount) %></th>
|
268
|
+
<th><%= I18n.t(:misc_type) %></th>
|
269
|
+
<th><%= I18n.t(:misc_use) %></th>
|
270
|
+
<th><%= I18n.t(:misc_time) %></th>
|
271
|
+
</tr>
|
272
|
+
</thead>
|
273
|
+
<tbody>
|
274
|
+
<% miscs.each do |m| %>
|
275
|
+
<meta itemprop="recipeIngredient"
|
276
|
+
content="<%= m.formatted_amount %> <%= I18n.t(m.unit, default: m.unit) %> <%= m.name %>">
|
277
|
+
<tr>
|
278
|
+
<td class="misc_name"><%= I18n.t(m.name, default: m.name) %></td>
|
279
|
+
<td class="misc_amount format_number"><%= m.formatted_amount %> <%= I18n.t(m.unit, default: m.unit) %></td>
|
280
|
+
<td class="misc_type"><%= I18n.t(m.type, default: m.type) %></td>
|
281
|
+
<td class="misc_use"><%= I18n.t(m.use, default: m.use) %></td>
|
282
|
+
<td class="misc_time"><%= m.formatted_time %> <%= I18n.t(m.time_unit, default: m.time_unit) %></td>
|
283
|
+
</tr>
|
284
|
+
<% end %>
|
285
|
+
</tbody>
|
286
|
+
</table>
|
287
|
+
</section>
|
288
|
+
<% end %>
|
289
|
+
|
290
290
|
<section class="yeasts">
|
291
291
|
<h2><%= I18n.t(:yeasts) %></h2>
|
292
292
|
<table>
|