Sha256: 66335942d617f0de87e3f9e43b3c627b7e728a973c11bb98c70bcb3ff54528e2
Contents?: true
Size: 746 Bytes
Versions: 13
Compression:
Stored size: 746 Bytes
Contents
class INE::Places::Province < OpenStruct include INE::Places::CSVRecord def self.find_all_by_autonomous_region_id(autonomous_region_id) raise ArgumentError if autonomous_region_id.blank? collection_klass.records.select{|province| province.autonomous_region_id == autonomous_region_id } end def places INE::Places::Place.find_all_by_province_id(self.id) end private def self.collection_klass INE::Places::ProvincesCollection end def self.filter(records, name) return [] if name.blank? parameterized_name = name.parameterize records.select{|p| p.slug.include?(parameterized_name) }. reject{|p| ['ceuta','melilla'].include?(p.slug) }. sort_by{|p| p.autonomous_region.slug } end end
Version data entries
13 entries across 13 versions & 1 rubygems