lib/geolookup/usa/state.rb in geolookup-0.5.0 vs lib/geolookup/usa/state.rb in geolookup-0.5.1
- old
+ new
@@ -19,9 +19,19 @@
def self.code_to_abbreviation(state_code)
CODE_TO_STATE[state_code.to_s.to_i]
end
###################################################################
+ # self.name_to_abbreviation
+ #
+ # Given a state name OR abbreviation return a code. It takes both an abbreviation and
+ # a state full name
+ #
+ def self.name_to_abbreviation(state_abbrev)
+ code_to_name(abbreviation_to_code(state_abbrev))
+ end
+
+ ###################################################################
# self.state_name_to_code
#
# Given a state name OR abbreviation return a code. It takes both an abbreviation and
# a state full name
#
\ No newline at end of file