Sha256: 8a4dffd86d052ef94458d85682926135aea4a258b9ee7deea174b94e5987fb8a

Contents?: true

Size: 714 Bytes

Versions: 6

Compression:

Stored size: 714 Bytes

Contents

class String

  def zip_info(**kwargs)
    Zipcoder.zip_info self, **kwargs
  end

  def zip_cities(**kwargs)
    Zipcoder.zip_cities self, **kwargs
  end

  def city_info(**kwargs)
    Zipcoder.city_info self, **kwargs
  end

  def state_cities(**kwargs)
    Zipcoder.state_cities self, **kwargs
  end

  def to_zip
    self
  end

  def is_zip?
    self.length == 5
  end

  def breakout_zips
    zips = []
    self.split(',').each do |zip_group|
      if zip_group.include? '-'
        components = zip_group.split('-')
        ((components[0].to_i)..(components[1].to_i)).each do |zip|
          zips.push(zip.to_s)
        end
      else
        zips.push(zip_group)
      end
    end
    zips.sort
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
zipcoder-0.8.2 lib/zipcoder/ext/string.rb
zipcoder-0.8.1 lib/zipcoder/ext/string.rb
zipcoder-0.8.0 lib/zipcoder/ext/string.rb
zipcoder-0.7.4 lib/zipcoder/ext/string.rb
zipcoder-0.7.3 lib/zipcoder/ext/string.rb
zipcoder-0.7.2 lib/zipcoder/ext/string.rb