pitosalas-govsdk 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.yml +1 -1
- data/lib/util.rb +3 -0
- data/test/util_test.rb +4 -1
- metadata +2 -2
data/VERSION.yml
CHANGED
data/lib/util.rb
CHANGED
@@ -97,6 +97,7 @@ class Util
|
|
97
97
|
# 2 letter code for state that most closely matches state_name, or nil.
|
98
98
|
#
|
99
99
|
def self.lookup_state_name(state_name)
|
100
|
+
return state_name.upcase if STATE_ABBR.has_key?(state_name.upcase)
|
100
101
|
matches = STATE_ABBR.select { |k,v| v.include? state_name.capitalize}
|
101
102
|
if matches.length == 1
|
102
103
|
return matches[0][0]
|
@@ -106,5 +107,7 @@ class Util
|
|
106
107
|
end
|
107
108
|
|
108
109
|
end
|
110
|
+
|
111
|
+
|
109
112
|
|
110
113
|
|
data/test/util_test.rb
CHANGED
@@ -29,12 +29,15 @@
|
|
29
29
|
|
30
30
|
require File.dirname(__FILE__) + '/test_helper'
|
31
31
|
|
32
|
-
class
|
32
|
+
class UtilTest < Test::Unit::TestCase
|
33
33
|
context "Util methods test" do
|
34
34
|
|
35
35
|
should "Lookup a state" do
|
36
36
|
assert_equal "MA", Util.lookup_state_name("Mass")
|
37
37
|
assert_equal "MA", Util.lookup_state_name("mass")
|
38
|
+
assert_equal "MA", Util.lookup_state_name("MA")
|
39
|
+
assert_equal "WV", Util.lookup_state_name("WV")
|
40
|
+
assert_equal "WV", Util.lookup_state_name("wv")
|
38
41
|
assert_equal nil, Util.lookup_state_name("new")
|
39
42
|
assert_equal nil, Util.lookup_state_name("pito")
|
40
43
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pitosalas-govsdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pito Salas
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-02
|
12
|
+
date: 2009-03-02 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|