Class: Brewscribe::Carbonation

Inherits:
Object
  • Object
show all
Includes:
Conversion
Defined in:
lib/brewscribe/carbonation.rb

Constant Summary collapse

TYPES =
['Bottle', 'Keg', 'Keg with priming agent']
KEY_CONVERSION =
{
  carb_rate: PERCENT_CONV,
  temperature: FLOAT_CONV,
  type: ->(t) { TYPES[t.to_i] },
  last_modified: DATE_CONV
}

Constants included from Conversion

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

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from Conversion

#data_to_properties

Instance Attribute Details

#carb_rateObject

Returns the value of attribute carb_rate.



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

def carb_rate
  @carb_rate
end

#last_modifiedObject

Returns the value of attribute last_modified.



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

def last_modified
  @last_modified
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#notesObject

Returns the value of attribute notes.



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

def notes
  @notes
end

#primer_nameObject

Returns the value of attribute primer_name.



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

def primer_name
  @primer_name
end

#temperatureObject

Returns the value of attribute temperature.



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

def temperature
  @temperature
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

Class Method Details

.from_data(data) ⇒ Object



16
17
18
19
20
21
# File 'lib/brewscribe/carbonation.rb', line 16

def self.from_data data
  carb = new
  carb.data_to_properties data  

  carb
end