Class: Brewser::Hop
Direct Known Subclasses
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
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/brewser/model/hop.rb', line 27 def self.json_create(o) a = self.new a.name = o['name'] a.origin = o['origin'] a.description = o['description'] a.type = o['type'] a.alpha_acids = o['alpha_acids'] a.beta_acids = o['beta_acids'] a.added_when = o['added_when'] a.time = o['time'].u unless o['time'].blank? a.amount = o['amount'].u unless o['amount'].blank? a.form = o['form'] a.storageability = o['storageability'] a.substitutes = o['substitutes'] a.humulene = o['humulene'] a.caryophyllene = o['caryophyllene'] a.cohumulone = o['cohumulone'] a.myrcene = o['myrcene'] a.farnsene = o['farnsene'] a.total_oil = o['total_oil'] return a end |
Instance Method Details
#as_json(options = {}) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/brewser/model/hop.rb', line 51 def as_json(={}) { JSON.create_id=> "Brewser::Hop", 'name' => name, 'origin' => origin, 'description' => description, 'type' => type, 'alpha_acids' => alpha_acids, 'beta_acids' => beta_acids, 'added_when' => added_when, 'time' => time.to_s, 'amount' => amount.to_s, 'form' => form, 'storageability' => storageability, 'substitutes' => substitutes, 'humulene' => humulene, 'caryophyllene' => caryophyllene, 'cohumulone' => cohumulone, 'myrcene' => myrcene, 'farnsene' => farnsene, 'total_oil' => total_oil } end |