2010-06-09 19:56:47 -07:00
|
|
|
class StaticResource
|
|
|
|
attr_accessor :id, :name
|
|
|
|
|
|
|
|
def self.all
|
|
|
|
@objects
|
|
|
|
end
|
|
|
|
|
2013-01-22 22:25:09 -08:00
|
|
|
def self.find(id_or_ids)
|
|
|
|
if id_or_ids.is_a?(Array)
|
|
|
|
id_or_ids.uniq.map { |id| find_one(id) }
|
|
|
|
else
|
|
|
|
find_one(id_or_ids)
|
|
|
|
end
|
2010-06-09 19:56:47 -07:00
|
|
|
end
|
2011-01-27 13:35:46 -08:00
|
|
|
|
|
|
|
def self.count
|
|
|
|
@objects.size
|
|
|
|
end
|
2013-01-22 22:25:09 -08:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def self.find_one(id)
|
|
|
|
@objects[id - 1]
|
|
|
|
end
|
2010-06-09 19:56:47 -07:00
|
|
|
end
|