Class: Brewser::Style

Inherits:
Model
  • Object
show all
Defined in:
lib/brewser/model/style.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



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/brewser/model/style.rb', line 29

def self.json_create(o)
  a = self.new
  a.name = o['name']
  a.category = o['category']
  a.category_number = o['category_number']
  a.style_letter = o['style_letter']
  a.type = o['type']
  a.style_guide = o['style_guide']

  return a
end

Instance Method Details

#as_json(options = {}) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/brewser/model/style.rb', line 41

def as_json(options={})
  {
    JSON.create_id => "Brewser::Style",
      'name' => name, 'category' => category, 
      'category_number' => category_number, 'style_letter' => style_letter,
      'type' => type, 'style_guide' => style_guide
  }
end