Class: ProMashRec::Hop

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

Constant Summary collapse

@@hop_types =
{0 => "Both", 1 => "Bittering", 2 => "Aroma"}
@@hop_forms =
{0 => "Whole", 1 => "Plug", 2 => "Pellet"}

Instance Method Summary collapse

Methods inherited from Brewser::Hop

#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(hop, time) ⇒ Object

Pellet 21, 23



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/brewser/engines/promash_rec.rb', line 216

def from_promash(hop,time)
  self.name = hop.name.split("\x00")[0]
  self.origin = hop.origin.split("\x00")[0]
  self.alpha_acids = hop.alpha_acids
  self.beta_acids = hop.beta_acids
  self.type = @@hop_types[hop.type]
  self.form = @@hop_forms[hop.form]
  self.amount = "#{hop.amount} oz".u
  self.time = "#{hop.time} min".u
  self.storageability = hop.storage_factor
  self.humulene = hop.humulene
  self.caryophyllene = hop.caryphylene
  self.cohumulone = hop.cohumulone
  self.myrcene = hop.myrcene
  if hop.time.to_i >= 0 and hop.time.to_i <= time
    self.added_when = "Boil"
  elsif hop.time.to_i == time+1
    self.added_when = "FWH"
  elsif hop.time.to_i == time+2
    self.added_when = "Mash"
  else
    self.added_when = "Dry"
  end
  
  return self
end