Class: Brewscribe::Hops

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Methods included from Conversion

#data_to_properties

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

#alphaObject (readonly)

Returns the value of attribute alpha.



3
4
5
# File 'lib/brewscribe/hops.rb', line 3

def alpha
  @alpha
end

#amountObject (readonly)

Returns the value of attribute amount.



3
4
5
# File 'lib/brewscribe/hops.rb', line 3

def amount
  @amount
end

#betaObject (readonly)

Returns the value of attribute beta.



3
4
5
# File 'lib/brewscribe/hops.rb', line 3

def beta
  @beta
end

#boil_timeObject (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_timeObject (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

#formObject (readonly)

Returns the value of attribute form.



3
4
5
# File 'lib/brewscribe/hops.rb', line 3

def form
  @form
end

#hsiObject (readonly)

Returns the value of attribute hsi.



3
4
5
# File 'lib/brewscribe/hops.rb', line 3

def hsi
  @hsi
end

#ibu_contribObject (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_recipeObject (readonly)

Returns the value of attribute in_recipe.



3
4
5
# File 'lib/brewscribe/hops.rb', line 3

def in_recipe
  @in_recipe
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/brewscribe/hops.rb', line 3

def name
  @name
end

#notesObject (readonly)

Returns the value of attribute notes.



3
4
5
# File 'lib/brewscribe/hops.rb', line 3

def notes
  @notes
end

#originObject (readonly)

Returns the value of attribute origin.



3
4
5
# File 'lib/brewscribe/hops.rb', line 3

def origin
  @origin
end

#percentObject (readonly)

Returns the value of attribute percent.



3
4
5
# File 'lib/brewscribe/hops.rb', line 3

def percent
  @percent
end

#priceObject (readonly)

Returns the value of attribute price.



3
4
5
# File 'lib/brewscribe/hops.rb', line 3

def price
  @price
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/brewscribe/hops.rb', line 3

def type
  @type
end

#useObject (readonly)

Returns the value of attribute use.



3
4
5
# File 'lib/brewscribe/hops.rb', line 3

def use
  @use
end