Class: ProMashRec::Recipe

Inherits:
Brewser::Recipe show all
Defined in:
lib/brewser/engines/promash_rec.rb

Constant Summary collapse

@@recipe_types =
{ 0 => "Other", 15 => "Lager", 25 => "Hybrid", 30 => "Ale" }
@@brew_methods =
{ 0 => "All Grain", 1 => "Partial Mash", 2 => "Extract" }

Instance Method Summary collapse

Methods inherited from Brewser::Recipe

#as_json, json_create

Methods inherited from Brewser::Model

#as_beerxml, #as_brewson, auto_migrate_down!, auto_migrate_up!, auto_upgrade!, default_repository_name

Instance Method Details

#from_promash(data) ⇒ Object



415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
# File 'lib/brewser/engines/promash_rec.rb', line 415

def from_promash(data)
  rec = Loader::Recipe.read(data)
  self.name = rec.title.split("\x00")[0]
  self.method = @@brew_methods[rec._brew_method]
  self.recipe_volume = "#{rec.recipe_volume} gal".u
  self.boil_volume = "#{rec.boil_volume} gal".u
  self.boil_time = "#{rec.boil_time} min".u
  self.estimated_og = (1+rec.estimated_og/1000).round(3)
  self.estimated_ibu = rec.estimated_ibu.round(1)
  self.recipe_efficiency = rec.recipe_efficiency*100
  self.style = ProMashRec::Style.new.from_promash(rec.style)
  rec.hops.each do |hop|
    self.hops.push ProMashRec::Hop.new.from_promash(hop,rec.boil_time.to_i)
  end
  rec.fermentables.each do |fermentable|
    self.fermentables.push ProMashRec::Fermentable.new.from_promash(fermentable)
  end
  rec.additives.each do |additive|
    self.additives.push ProMashRec::Additive.new.from_promash(additive)
  end
  self.yeasts.push ProMashRec::Yeast.new.from_promash(rec.yeast)
  self.water_profile = ProMashRec::WaterProfile.new.from_promash(rec.water_profile)
  self.mash_schedule = ProMashRec::SimpleSchedule.new.from_promash(rec.simple_schedule)
  self.description = rec.notes
  self.type = self.style.type

  return self
end