2010-06-09 19:56:47 -07:00
|
|
|
class Zone < StaticResource
|
2010-06-22 09:42:25 -07:00
|
|
|
AttributeNames = ['id', 'label', 'depth', 'type_id']
|
|
|
|
ItemZoneSets = {}
|
2010-06-09 19:56:47 -07:00
|
|
|
|
|
|
|
attr_reader *AttributeNames
|
|
|
|
|
|
|
|
def initialize(attributes)
|
|
|
|
AttributeNames.each do |name|
|
|
|
|
instance_variable_set "@#{name}", attributes[name]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
n = 0
|
|
|
|
@objects = YAML.load_file(Rails.root.join('config', 'zones.yml')).map do |a|
|
|
|
|
a['id'] = (n += 1)
|
2010-06-22 09:42:25 -07:00
|
|
|
obj = new(a)
|
|
|
|
if obj.type_id == 2 || obj.type_id == 3
|
|
|
|
zone_name = obj.label.delete(' -').gsub(/item$/, '').downcase
|
|
|
|
ItemZoneSets[zone_name] ||= []
|
|
|
|
ItemZoneSets[zone_name] << obj
|
|
|
|
end
|
|
|
|
obj
|
2010-06-09 19:56:47 -07:00
|
|
|
end
|
|
|
|
n = nil
|
2010-05-20 16:04:56 -07:00
|
|
|
end
|