class Flavordb::Base

Attributes

id[R]
name[R]
resource[R]

Public Class Methods

get_or_create(data) click to toggle source
# File lib/flavordb/base.rb, line 6
def get_or_create (data)
  #puts "GET OR CREATE #{data}"
  object_id = data['id']
  #puts "OBJECT ID #{object_id}"
  if object_id.nil?
    nil
  else
    object = object_cache[object_id]
    if object.nil?
      object = self.new data
      object_cache[object_id] = object
    end
    object
  end
end
new(data) click to toggle source
# File lib/flavordb/base.rb, line 25
def initialize (data)
  @id = data['id']
  @name = data['name']
  @resource = data['resource']
  @description = data['description']
end