Sha256: de9d4c447de1fb52f4118d7bc84107dd9e90b015b608aec49232be34d3934178
Contents?: true
Size: 941 Bytes
Versions: 4
Compression:
Stored size: 941 Bytes
Contents
require 'carmen/querying' module Carmen # RegionCollection is responsible for holding the subregions for a # region and also provides an interface to query said subregions. # # Example: # # states = Carmen::Country.coded('US').subregions # => #<RegionCollection> # states.size # => 5 # states.named('Illinois') # => #<Region name:"Illinois" code: "IL"> # class RegionCollection < Array include Querying # Filters the regions in this collection by type. # # type - The String type to filter by # # Returns a region collection containing all the regions with the supplied # type. def typed(type) downcased_type = type.downcase results = select{ |r| r.type == downcased_type } Carmen::RegionCollection.new(results) end private def query_collection self end def attribute_to_search_for_code(code) :code end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
carmen-1.1.3 | lib/carmen/region_collection.rb |
carmen-1.1.2 | lib/carmen/region_collection.rb |
carmen-1.1.1 | lib/carmen/region_collection.rb |
carmen-1.1.0 | lib/carmen/region_collection.rb |