Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/zipcoder/ext/string.rb

Instance Method Summary collapse

Instance Method Details

#breakout_zipsObject



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

Returns:

  • (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_zipObject



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

#zip_info(**kwargs) ⇒ Object



3
4
5
# File 'lib/zipcoder/ext/string.rb', line 3

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