Class: Brewser::Yeast
- Inherits:
-
Model
- Object
- Model
- Brewser::Yeast
show all
- Defined in:
- lib/brewser/model/yeast.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/brewser/model/yeast.rb', line 28
def self.json_create(o)
a = self.new
a.name = o['name']
a.description = o['description']
a.type = o['type']
a.best_for = o['best_for']
a.supplier = o['supplier']
a.catalog = o['catalog']
a.min_temperature = o['min_temperature'].u unless o['min_temperature'].blank?
a.max_temperature = o['max_temperature'].u unless o['max_temperature'].blank?
a.flocculation = o['flocculation']
a.attenuation = o['attenuation']
a.add_to_secondary = o['add_to_secondary']
a.form = o['form']
a.amount = o['amount'].u unless o['amount'].blank?
a.max_reuse = o['max_reuse']
a.times_cultured = o['times_cultured']
return a
end
|
Instance Method Details
#as_json(options = {}) ⇒ Object
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/brewser/model/yeast.rb', line 50
def as_json(options={})
{
JSON.create_id => "Brewser::Yeast",
'name' => name,
'description' => description,
'type' => type, 'best_for' => best_for,
'supplier' => supplier, 'catalog' => catalog,
'min_temperature' => min_temperature.to_s, 'max_temperature' => max_temperature.to_s,
'flocculation' => flocculation, 'attenuation' => attenuation,
'add_to_secondary' => add_to_secondary?,
'form' => form, 'amount' => amount.to_s,
'max_reuse' => max_reuse, 'times_cultured' => times_cultured
}
end
|