Sha256: bd296ff4db9a1f24c10648f3f424a78b4c5e51b6eedd63ad119d981a0433107c

Contents?: true

Size: 536 Bytes

Versions: 9

Compression:

Stored size: 536 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]
    })
  end
  private_class_method :build_from_raw_data

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ine-places-0.2.0 lib/ine/places/autonomous_regions_collection.rb
ine-places-0.1.7 lib/ine/places/autonomous_regions_collection.rb
ine-places-0.1.6 lib/ine/places/autonomous_regions_collection.rb
ine-places-0.1.5 lib/ine/places/autonomous_regions_collection.rb
ine-places-0.1.4 lib/ine/places/autonomous_regions_collection.rb
ine-places-0.1.3 lib/ine/places/autonomous_regions_collection.rb
ine-places-0.1.2 lib/ine/places/autonomous_regions_collection.rb
ine-places-0.1.1 lib/ine/places/autonomous_regions_collection.rb
ine-places-0.1.0 lib/ine/places/autonomous_regions_collection.rb