beer_recipe 0.4.6 → 0.4.7
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/hop_wrapper.rb +5 -1
- data/lib/beer_recipe/mash_step_wrapper.rb +16 -0
- data/lib/beer_recipe/mash_wrapper.rb +1 -1
- data/lib/beer_recipe/misc_wrapper.rb +3 -2
- data/lib/beer_recipe/recipe_wrapper.rb +30 -6
- data/lib/beer_recipe/version.rb +1 -1
- data/lib/beer_recipe/wrapper.rb +4 -0
- data/lib/beer_recipe/yeast_wrapper.rb +2 -0
- 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: 40c81b35807a30b9416ebafbcdd7ac37406c1f59
|
4
|
+
data.tar.gz: 95ebf28d71688df5b73211de49f46364c7bb51b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac17a5778a5de1c1fb95d32c13b11355a98edcd632f1624eadb4bfa100aa45c11a757c86a23350e9e1c7d1a3f303352e2d4cd16d451c0fb85484cae64779ee88
|
7
|
+
data.tar.gz: a45c0c6ac75ce3d7e6dd02482147515184eb9847ac701566e2f3f2486c7e97a59f4169d28641c549008b6e66fd557ae6dc99f753b3d0aa65b6350c81f7ab834d
|
@@ -14,7 +14,11 @@ class BeerRecipe::HopWrapper < BeerRecipe::Wrapper
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def ibu
|
17
|
-
@ibu ||=
|
17
|
+
@ibu ||= if @recipe.has_final_values? && @recipe.batch_size > 0 && amount > 0 && @record.time > 0
|
18
|
+
BeerRecipe::Formula.new.tinseth(@recipe.batch_size, @record.time, @recipe.og, @record.alpha, amount)
|
19
|
+
else
|
20
|
+
0
|
21
|
+
end
|
18
22
|
end
|
19
23
|
|
20
24
|
def dryhop?
|
@@ -1,4 +1,20 @@
|
|
1
1
|
class BeerRecipe::Mash_stepWrapper < BeerRecipe::Wrapper
|
2
|
+
def step_temp
|
3
|
+
super || 0
|
4
|
+
end
|
5
|
+
|
6
|
+
def ramp_time
|
7
|
+
super || 0
|
8
|
+
end
|
9
|
+
|
10
|
+
def step_time
|
11
|
+
super || 0
|
12
|
+
end
|
13
|
+
|
14
|
+
def infuse_amount
|
15
|
+
super || 0
|
16
|
+
end
|
17
|
+
|
2
18
|
def formatted_step_temp
|
3
19
|
"#{'%.0f' % step_temp}"
|
4
20
|
end
|
@@ -6,7 +6,7 @@ class BeerRecipe::MiscWrapper < BeerRecipe::Wrapper
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def days?
|
9
|
-
time > DAY
|
9
|
+
!blank?(time) && time > DAY
|
10
10
|
end
|
11
11
|
|
12
12
|
def large_amount?
|
@@ -31,7 +31,8 @@ class BeerRecipe::MiscWrapper < BeerRecipe::Wrapper
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def formatted_time
|
34
|
-
|
34
|
+
return "" if blank?(time)
|
35
|
+
if days?
|
35
36
|
"#{'%.0f' % (time / DAY)}"
|
36
37
|
else
|
37
38
|
"#{'%.0f' % time}"
|
@@ -10,6 +10,10 @@ class BeerRecipe::RecipeWrapper < BeerRecipe::Wrapper
|
|
10
10
|
@record
|
11
11
|
end
|
12
12
|
|
13
|
+
def date
|
14
|
+
recipe.date || nil
|
15
|
+
end
|
16
|
+
|
13
17
|
def get_binding
|
14
18
|
binding
|
15
19
|
end
|
@@ -30,20 +34,32 @@ class BeerRecipe::RecipeWrapper < BeerRecipe::Wrapper
|
|
30
34
|
@mash ||= BeerRecipe::MashWrapper.new(recipe.mash, self)
|
31
35
|
end
|
32
36
|
|
33
|
-
def has_final_values?
|
34
|
-
og > 0 && fg > 0 && abv > 0
|
35
|
-
end
|
36
|
-
|
37
37
|
def file_name
|
38
38
|
I18n.transliterate(name.downcase.gsub(/\s+/, '_')).gsub(/[^a-z0-9_]/, '')
|
39
39
|
end
|
40
40
|
|
41
|
+
def has_final_values?
|
42
|
+
og > 0 && fg > 0 && abv > 0
|
43
|
+
end
|
44
|
+
|
41
45
|
def style_code
|
42
46
|
"#{recipe.style.category_number} #{recipe.style.style_letter}"
|
43
47
|
end
|
44
48
|
|
49
|
+
def batch_size
|
50
|
+
recipe.batch_size || 0
|
51
|
+
end
|
52
|
+
|
53
|
+
def og
|
54
|
+
recipe.og || 0
|
55
|
+
end
|
56
|
+
|
57
|
+
def fg
|
58
|
+
recipe.fg || 0
|
59
|
+
end
|
60
|
+
|
45
61
|
def abv
|
46
|
-
@abv ||= BeerRecipe::Formula.new.sg_to_abv(
|
62
|
+
@abv ||= BeerRecipe::Formula.new.sg_to_abv(og, fg)
|
47
63
|
end
|
48
64
|
|
49
65
|
def ibu
|
@@ -116,6 +132,10 @@ class BeerRecipe::RecipeWrapper < BeerRecipe::Wrapper
|
|
116
132
|
@hop_weight
|
117
133
|
end
|
118
134
|
|
135
|
+
def boil_time
|
136
|
+
recipe.boil_time || 0
|
137
|
+
end
|
138
|
+
|
119
139
|
def total_time
|
120
140
|
boil_time + mash.total_mash_time
|
121
141
|
end
|
@@ -142,7 +162,11 @@ class BeerRecipe::RecipeWrapper < BeerRecipe::Wrapper
|
|
142
162
|
end
|
143
163
|
|
144
164
|
def real_extract
|
145
|
-
@real_extract ||=
|
165
|
+
@real_extract ||= if og > 0 && fg > 0
|
166
|
+
BeerRecipe::Formula.new.real_extract(og, fg)
|
167
|
+
else
|
168
|
+
0
|
169
|
+
end
|
146
170
|
end
|
147
171
|
end
|
148
172
|
|
data/lib/beer_recipe/version.rb
CHANGED
data/lib/beer_recipe/wrapper.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
class BeerRecipe::YeastWrapper < BeerRecipe::Wrapper
|
2
2
|
def formatted_attenuation
|
3
|
+
return "" if blank?(attenuation)
|
3
4
|
"#{'%.0f' % attenuation}%"
|
4
5
|
end
|
5
6
|
|
6
7
|
def formatted_temperatures
|
8
|
+
return "" if blank?(min_temperature) || blank?(max_temperature)
|
7
9
|
"#{'%.0f' % min_temperature}°C - #{'%.0f' % max_temperature}°C"
|
8
10
|
end
|
9
11
|
end
|