Class: Brewscribe::Mash

Inherits:
Object
  • Object
show all
Includes:
Conversion
Defined in:
lib/brewscribe/mash.rb,
lib/brewscribe/mash/step.rb

Defined Under Namespace

Classes: Step

Constant Summary collapse

KEY_CONVERSION =
{
  last_modified: DATE_CONV,
  grain_weight: FLOAT_CONV,
  grain_temp: FLOAT_CONV,
  boil_temp: FLOAT_CONV,
  tun_temp: FLOAT_CONV,
  ph: FLOAT_CONV,
  sparge_temp: FLOAT_CONV,
  batch: FLOAT_CONV,
  batch_pct: PERCENT_CONV,
  batch_even: BOOLEAN_CONV,
  batch_drain: BOOLEAN_CONV,
  mash_39: BOOLEAN_CONV,
  tun_deadspace: FLOAT_CONV,
  biab_vol: FLOAT_CONV,
  biab: BOOLEAN_CONV,
  equip_adjust: BOOLEAN_CONV,
  tun_vol: FLOAT_CONV,
  tun_mass: FLOAT_CONV,
  tun_hc: FLOAT_CONV
}

Constants included from Conversion

Conversion::BOOLEAN_CONV, Conversion::DATE_CONV, Conversion::FLOAT_CONV, Conversion::INT_CONV, Conversion::PERCENT_CONV

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from Conversion

#data_to_properties

Instance Attribute Details

#batchObject

Returns the value of attribute batch.



5
6
7
# File 'lib/brewscribe/mash.rb', line 5

def batch
  @batch
end

#batch_drainObject

Returns the value of attribute batch_drain.



5
6
7
# File 'lib/brewscribe/mash.rb', line 5

def batch_drain
  @batch_drain
end

#batch_evenObject

Returns the value of attribute batch_even.



5
6
7
# File 'lib/brewscribe/mash.rb', line 5

def batch_even
  @batch_even
end

#batch_pctObject

Returns the value of attribute batch_pct.



5
6
7
# File 'lib/brewscribe/mash.rb', line 5

def batch_pct
  @batch_pct
end

#biabObject

Returns the value of attribute biab.



5
6
7
# File 'lib/brewscribe/mash.rb', line 5

def biab
  @biab
end

#biab_volObject

Returns the value of attribute biab_vol.



5
6
7
# File 'lib/brewscribe/mash.rb', line 5

def biab_vol
  @biab_vol
end

#boil_tempObject

Returns the value of attribute boil_temp.



5
6
7
# File 'lib/brewscribe/mash.rb', line 5

def boil_temp
  @boil_temp
end

#equip_adjustObject

Returns the value of attribute equip_adjust.



5
6
7
# File 'lib/brewscribe/mash.rb', line 5

def equip_adjust
  @equip_adjust
end

#grain_tempObject

Returns the value of attribute grain_temp.



5
6
7
# File 'lib/brewscribe/mash.rb', line 5

def grain_temp
  @grain_temp
end

#grain_weightObject

Returns the value of attribute grain_weight.



5
6
7
# File 'lib/brewscribe/mash.rb', line 5

def grain_weight
  @grain_weight
end

#last_modifiedObject

Returns the value of attribute last_modified.



5
6
7
# File 'lib/brewscribe/mash.rb', line 5

def last_modified
  @last_modified
end

#mash_39Object

Returns the value of attribute mash_39.



5
6
7
# File 'lib/brewscribe/mash.rb', line 5

def mash_39
  @mash_39
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/brewscribe/mash.rb', line 5

def name
  @name
end

#notesObject

Returns the value of attribute notes.



5
6
7
# File 'lib/brewscribe/mash.rb', line 5

def notes
  @notes
end

#phObject

Returns the value of attribute ph.



5
6
7
# File 'lib/brewscribe/mash.rb', line 5

def ph
  @ph
end

#sparge_tempObject

Returns the value of attribute sparge_temp.



5
6
7
# File 'lib/brewscribe/mash.rb', line 5

def sparge_temp
  @sparge_temp
end

#stepsObject

Returns the value of attribute steps.



5
6
7
# File 'lib/brewscribe/mash.rb', line 5

def steps
  @steps
end

#tun_deadspaceObject

Returns the value of attribute tun_deadspace.



5
6
7
# File 'lib/brewscribe/mash.rb', line 5

def tun_deadspace
  @tun_deadspace
end

#tun_hcObject

Returns the value of attribute tun_hc.



5
6
7
# File 'lib/brewscribe/mash.rb', line 5

def tun_hc
  @tun_hc
end

#tun_massObject

Returns the value of attribute tun_mass.



5
6
7
# File 'lib/brewscribe/mash.rb', line 5

def tun_mass
  @tun_mass
end

#tun_tempObject

Returns the value of attribute tun_temp.



5
6
7
# File 'lib/brewscribe/mash.rb', line 5

def tun_temp
  @tun_temp
end

#tun_volObject

Returns the value of attribute tun_vol.



5
6
7
# File 'lib/brewscribe/mash.rb', line 5

def tun_vol
  @tun_vol
end

Class Method Details

.from_data(data) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/brewscribe/mash.rb', line 34

def self.from_data data 
  mash = new
  mash.data_to_properties data
  
  if mash.steps[:data][:mashstep].class == Hash
    steps = [mash.steps[:data][:mashstep]]
  else
    steps = mash.steps[:data][:mashstep]
  end

  mash.steps = []
  steps.each do |step|
    mash.steps << Brewscribe::Mash::Step.from_data(step)  
  end

  mash
end