Sha256: 1f06c382326e4e39f53c3d945d96abbbe9ea9902522dce022927c067499e86fb
Contents?: true
Size: 486 Bytes
Versions: 2
Compression:
Stored size: 486 Bytes
Contents
module Geonames module Data class NameIndex def initialize(features) @index = features.inject({}) do |index, feature| feature.names.inject(index) do |index, name| index[name] ||= [] index[name].push(feature).uniq! index end end end def [](name) @index[name] end def self.load(filepath, &filter) new(Feature.load(filepath, &filter)) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
geonames-data-0.1.0 | lib/geonames/data/name_index.rb |
geonames-data-0.0.1 | lib/geonames/data/name_index.rb |