Sha256: deb56d11498ec3e3dbe57006c3a6edd1ab284a2ea4e24ee4021b3b5858e5af24
Contents?: true
Size: 652 Bytes
Versions: 3
Compression:
Stored size: 652 Bytes
Contents
class INE::Places::Place < OpenStruct include INE::Places::CSVRecord def self.find_all_by_province_id(province_id) raise ArgumentError if province_id.blank? collection_klass.records.select{ |place| place.province_id == province_id } end def data @data ||= OpenStruct.new end private def self.collection_klass INE::Places::PlacesCollection 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.province.slug } end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ine-places-0.1.6 | lib/ine/places/place.rb |
ine-places-0.1.5 | lib/ine/places/place.rb |
ine-places-0.1.4 | lib/ine/places/place.rb |