Sha256: 4568a5bcab3a04f135b5b38a314e86eff1ffb7a7d877053904714e8752c18b1a

Contents?: true

Size: 558 Bytes

Versions: 3

Compression:

Stored size: 558 Bytes

Contents

class INE::Places::AutonomousRegionsCollection
  include Singleton

  def self.records
    @records ||= CSV.read("#{INE::Places::ROOT}/data/autonomous_regions.csv", headers: true).map do |raw_data|
                   build_from_raw_data(raw_data)
                 end.sort_by(&:slug)
  end

  def self.build_from_raw_data(raw_data)
    INE::Places::AutonomousRegion.new({
      id: raw_data[0], name: raw_data[1], slug: raw_data[2],
      lon: raw_data[3], lat: raw_data[4], name_ca: raw_data[5]
    })
  end
  private_class_method :build_from_raw_data

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ine-places-0.5.0 lib/ine/places/autonomous_regions_collection.rb
ine-places-0.4.0 lib/ine/places/autonomous_regions_collection.rb
ine-places-0.3.0 lib/ine/places/autonomous_regions_collection.rb