Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/zipcoder/ext/string.rb
Instance Method Summary collapse
- #breakout_zips ⇒ Object
- #city_info(**kwargs) ⇒ Object
- #is_zip? ⇒ Boolean
- #state_cities(**kwargs) ⇒ Object
- #state_counties(**kwargs) ⇒ Object
- #to_zip ⇒ Object
- #zip_cities(**kwargs) ⇒ Object
- #zip_info(**kwargs) ⇒ Object
Instance Method Details
#breakout_zips ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/zipcoder/ext/string.rb', line 31 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 |
#city_info(**kwargs) ⇒ Object
11 12 13 |
# File 'lib/zipcoder/ext/string.rb', line 11 def city_info(**kwargs) Zipcoder.city_info self, **kwargs end |
#is_zip? ⇒ Boolean
27 28 29 |
# File 'lib/zipcoder/ext/string.rb', line 27 def is_zip? self.length == 5 end |
#state_cities(**kwargs) ⇒ Object
15 16 17 |
# File 'lib/zipcoder/ext/string.rb', line 15 def state_cities(**kwargs) Zipcoder.state_cities self, **kwargs end |
#state_counties(**kwargs) ⇒ Object
19 20 21 |
# File 'lib/zipcoder/ext/string.rb', line 19 def state_counties(**kwargs) Zipcoder.state_counties self, **kwargs end |
#to_zip ⇒ Object
23 24 25 |
# File 'lib/zipcoder/ext/string.rb', line 23 def to_zip self end |
#zip_cities(**kwargs) ⇒ Object
7 8 9 |
# File 'lib/zipcoder/ext/string.rb', line 7 def zip_cities(**kwargs) Zipcoder.zip_cities self, **kwargs end |