Class: Brewscribe::Hops
- Inherits:
-
Object
- Object
- Brewscribe::Hops
- Includes:
- Conversion
- Defined in:
- lib/brewscribe/hops.rb
Constant Summary collapse
- KEY_CONVERSION =
{ alpha: FLOAT_CONV, beta: FLOAT_CONV, boil_time: ->(k) { k.to_i }, percent: PERCENT_CONV, amount: FLOAT_CONV, hsi: FLOAT_CONV, dry_hop_time: ->(k) { k.to_i }, ibu_contrib: PERCENT_CONV, use: ->(k) { USES[k.to_i] }, type: ->(k) { TYPES[k.to_i] }, form: ->(k) { FORMS[k.to_i] }, in_recipe: BOOLEAN_CONV, price: FLOAT_CONV }
- TYPES =
['Bittering', 'Aroma', 'Both']
- FORMS =
['Pellet', 'Plug', 'Leaf']
- USES =
['Boil', 'Dry Hop', 'Mash', 'First Wort', 'Aroma']
Constants included from Conversion
Conversion::BOOLEAN_CONV, Conversion::DATE_CONV, Conversion::FLOAT_CONV, Conversion::INT_CONV, Conversion::PERCENT_CONV
Instance Attribute Summary collapse
-
#alpha ⇒ Object
readonly
Returns the value of attribute alpha.
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#beta ⇒ Object
readonly
Returns the value of attribute beta.
-
#boil_time ⇒ Object
readonly
Returns the value of attribute boil_time.
-
#dry_hop_time ⇒ Object
readonly
Returns the value of attribute dry_hop_time.
-
#form ⇒ Object
readonly
Returns the value of attribute form.
-
#hsi ⇒ Object
readonly
Returns the value of attribute hsi.
-
#ibu_contrib ⇒ Object
readonly
Returns the value of attribute ibu_contrib.
-
#in_recipe ⇒ Object
readonly
Returns the value of attribute in_recipe.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#notes ⇒ Object
readonly
Returns the value of attribute notes.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#percent ⇒ Object
readonly
Returns the value of attribute percent.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#use ⇒ Object
readonly
Returns the value of attribute use.
Instance Method Summary collapse
-
#initialize(data) ⇒ Hops
constructor
A new instance of Hops.
Methods included from Conversion
Constructor Details
#initialize(data) ⇒ Hops
Returns a new instance of Hops.
29 30 31 32 |
# File 'lib/brewscribe/hops.rb', line 29 def initialize data @original_data = data data_to_properties data end |
Instance Attribute Details
#alpha ⇒ Object (readonly)
Returns the value of attribute alpha.
3 4 5 |
# File 'lib/brewscribe/hops.rb', line 3 def alpha @alpha end |
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
3 4 5 |
# File 'lib/brewscribe/hops.rb', line 3 def amount @amount end |
#beta ⇒ Object (readonly)
Returns the value of attribute beta.
3 4 5 |
# File 'lib/brewscribe/hops.rb', line 3 def beta @beta end |
#boil_time ⇒ Object (readonly)
Returns the value of attribute boil_time.
3 4 5 |
# File 'lib/brewscribe/hops.rb', line 3 def boil_time @boil_time end |
#dry_hop_time ⇒ Object (readonly)
Returns the value of attribute dry_hop_time.
3 4 5 |
# File 'lib/brewscribe/hops.rb', line 3 def dry_hop_time @dry_hop_time end |
#form ⇒ Object (readonly)
Returns the value of attribute form.
3 4 5 |
# File 'lib/brewscribe/hops.rb', line 3 def form @form end |
#hsi ⇒ Object (readonly)
Returns the value of attribute hsi.
3 4 5 |
# File 'lib/brewscribe/hops.rb', line 3 def hsi @hsi end |
#ibu_contrib ⇒ Object (readonly)
Returns the value of attribute ibu_contrib.
3 4 5 |
# File 'lib/brewscribe/hops.rb', line 3 def ibu_contrib @ibu_contrib end |
#in_recipe ⇒ Object (readonly)
Returns the value of attribute in_recipe.
3 4 5 |
# File 'lib/brewscribe/hops.rb', line 3 def in_recipe @in_recipe end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/brewscribe/hops.rb', line 3 def name @name end |
#notes ⇒ Object (readonly)
Returns the value of attribute notes.
3 4 5 |
# File 'lib/brewscribe/hops.rb', line 3 def notes @notes end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
3 4 5 |
# File 'lib/brewscribe/hops.rb', line 3 def origin @origin end |
#percent ⇒ Object (readonly)
Returns the value of attribute percent.
3 4 5 |
# File 'lib/brewscribe/hops.rb', line 3 def percent @percent end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
3 4 5 |
# File 'lib/brewscribe/hops.rb', line 3 def price @price end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/brewscribe/hops.rb', line 3 def type @type end |
#use ⇒ Object (readonly)
Returns the value of attribute use.
3 4 5 |
# File 'lib/brewscribe/hops.rb', line 3 def use @use end |