Class: Brewser::WaterProfile

Inherits:
Model
  • Object
show all
Defined in:
lib/brewser/model/water_profile.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

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

Class Method Details

.json_create(o) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/brewser/model/water_profile.rb', line 17

def self.json_create(o)
  a = self.new
  a.name = o['name']
  a.description = o['description']
  a.calcium = o['calcium']
  a.sodium = o['sodium']
  a.magnesium = o['magnesium']
  a.chloride = o['chloride']
  a.sulfates = o['sulfates']
  a.bicarbonate = o['bicarbonate']
  a.alkalinity = o['alkalinity']
  a.ph = o['ph']
  
  return a
end

Instance Method Details

#as_json(options = {}) ⇒ Object



33
34
35
36
37
38
39
40
41
42
# File 'lib/brewser/model/water_profile.rb', line 33

def as_json(options={})
  {
    JSON.create_id => "Brewser::WaterProfile",
    'name' => name, 'description' => description,
    'calcium' => calcium, 'magnesium' => magnesium,
    'sodium' => sodium, 'chloride' => chloride,
    'sulfates' => sulfates, 'bicarbonate' => bicarbonate,
    'alkalinity' => alkalinity, 'ph' => ph
  }
end