Class: Flavordb::Base
- Inherits:
-
Object
- Object
- Flavordb::Base
- Defined in:
- lib/flavordb/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Class Method Summary collapse
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/flavordb/base.rb', line 3 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/flavordb/base.rb', line 3 def name @name end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
3 4 5 |
# File 'lib/flavordb/base.rb', line 3 def resource @resource end |
Class Method Details
.get_or_create(data) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# 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 |