Class: BeerRecipe::FermentableWrapper
- Inherits:
-
Wrapper
- Object
- Wrapper
- BeerRecipe::FermentableWrapper
show all
- Defined in:
- lib/beer_recipe/fermentable_wrapper.rb
Instance Method Summary
collapse
Methods inherited from Wrapper
#blank?, #format_method, #initialize, #method_missing, #respond_to_missing?, set, wrap
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class BeerRecipe::Wrapper
Instance Method Details
#amount_in_pounds ⇒ Object
38
39
40
|
# File 'lib/beer_recipe/fermentable_wrapper.rb', line 38
def amount_in_pounds
amount * 2.20462
end
|
#amount_percent ⇒ Object
57
58
59
|
# File 'lib/beer_recipe/fermentable_wrapper.rb', line 57
def amount_percent
amount / @recipe.total_grains * 100
end
|
34
35
36
|
# File 'lib/beer_recipe/fermentable_wrapper.rb', line 34
def
!ibu_gal_per_lb.nil?
end
|
#color_class ⇒ Object
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/beer_recipe/fermentable_wrapper.rb', line 42
def color_class
c = color_srm.to_i
if c > 40
'srm-max'
elsif c < 1
'srm-min'
else
"srm#{c}"
end
end
|
#color_ebc ⇒ Object
10
11
12
|
# File 'lib/beer_recipe/fermentable_wrapper.rb', line 10
def color_ebc
color
end
|
#color_hex ⇒ Object
53
54
55
|
# File 'lib/beer_recipe/fermentable_wrapper.rb', line 53
def color_hex
"#%02x%02x%02x" % BeerRecipe::Formula.new.srm_to_rgb(color_srm)
end
|
#color_srm ⇒ Object
14
15
16
|
# File 'lib/beer_recipe/fermentable_wrapper.rb', line 14
def color_srm
@color_srm ||= BeerRecipe::Formula.new.ebc_to_srm(color_ebc)
end
|
2
3
4
|
# File 'lib/beer_recipe/fermentable_wrapper.rb', line 2
def formatted_amount
"#{'%.2f' % amount}"
end
|
6
7
8
|
# File 'lib/beer_recipe/fermentable_wrapper.rb', line 6
def formatted_color
"#{'%.0f' % color_ebc}"
end
|
#ibu ⇒ Object
26
27
28
29
30
31
32
|
# File 'lib/beer_recipe/fermentable_wrapper.rb', line 26
def ibu
if
amount_in_pounds * ibu_gal_per_lb / @recipe.gallons
else
0
end
end
|
#mcu ⇒ Object
22
23
24
|
# File 'lib/beer_recipe/fermentable_wrapper.rb', line 22
def mcu
@mcu ||= BeerRecipe::Formula.new.mcu(amount, color_srm, @recipe.batch_size)
end
|