Class: ProMashRec::Recipe
- Inherits:
-
Brewser::Recipe
- Object
- Brewser::Model
- Brewser::Recipe
- ProMashRec::Recipe
- 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::Model
#as_beerxml, #as_brewson, auto_migrate_down!, auto_migrate_up!, auto_upgrade!, #deep_json, default_repository_name, #to_json
Instance Method Details
#from_promash(data) ⇒ Object
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
# File 'lib/brewser/engines/promash_rec.rb', line 391 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) if rec.simple_schedule.num_steps > 0 self.mash_schedule = ProMashRec::SimpleSchedule.new.from_promash(rec.simple_schedule) else self.mash_schedule = ProMashRec::MashSchedule.new.from_promash(rec.mash_schedule) end self.description = rec.notes self.type = self.style.type #puts rec.snapshot return self end |