lib/ext/string.rb in zipcoder-0.1.0 vs lib/ext/string.rb in zipcoder-0.2.0
- old
+ new
@@ -1,34 +1,17 @@
require_relative "../zipcoder"
class String
def zip_info(**kwargs)
- info = Zipcoder.zip_lookup[self]
-
- # Filter to the included keys
- if kwargs[:keys] != nil
- new_info = {}
- kwargs[:keys].each { |k| new_info[k] = info[k] }
- info = new_info
- end
-
- info
+ Zipcoder.zip_info self, **kwargs
end
def city_info(**kwargs)
- # Cleanup "self"
- key = self.delete(' ').upcase
+ Zipcoder.city_info self, **kwargs
+ end
- info = Zipcoder.city_lookup[key]
-
- # Filter to the included keys
- if kwargs[:keys] != nil
- new_info = {}
- kwargs[:keys].each { |k| new_info[k] = info[k] }
- info = new_info
- end
-
- info
+ def to_zip
+ self
end
end
\ No newline at end of file