Sha256: 443507903caf767195ff76efa2041db39d44201c371ee57ae6458ff8a6121fbc

Contents?: true

Size: 808 Bytes

Versions: 3

Compression:

Stored size: 808 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 state_counties(**kwargs)
    Zipcoder.state_counties self, **kwargs
  end

  def to_zip
    self
  end

  def is_zip?
    self.length == 5
  end

  def breakout_zips
    zips = []
    self.gsub(" ","").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

3 entries across 3 versions & 1 rubygems

Version Path
zipcoder-0.9.2 lib/zipcoder/ext/string.rb
zipcoder-0.9.1 lib/zipcoder/ext/string.rb
zipcoder-0.9.0 lib/zipcoder/ext/string.rb