traveller 0.0.005 → 0.0.006
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.
- checksums.yaml +4 -4
- data/lib/traveller.rb +4 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5395fbdf47bb930a671b906aa8613630df34cc8
|
4
|
+
data.tar.gz: 212a2c5db57969e6b7509b4aee33ed9ec6c5e566
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0391c533c0caf45ca373d9fe9830d938ae1247ea53829ae65920fcb255fa483538b3465b4e14187b798c0c7cf6052380f7e6b6e8f6dff9176132b22b754ce90b
|
7
|
+
data.tar.gz: cc0618b96bdcbfda1d7d8a79338ceb72f04c17f7759fad5c7f86e2f0901a19d8235770aaf829f9df00425f1773ab66fd46d4a29b202f83c89f94d1c14c6b9671
|
data/lib/traveller.rb
CHANGED
@@ -32,25 +32,24 @@ class Traveller
|
|
32
32
|
single_word_states = ['alabama', 'alaska', 'arizona', 'arkansas', 'california', 'colorado', 'connecticut', 'delaware', 'florida', 'georgia', 'hawaii', 'idaho', 'illinois', 'indiana', 'iowa', 'kansas', 'kentucky', 'louisiana', 'maine', 'maryland', 'massachusetts', 'michigan', 'minnesota', 'mississippi', 'missouri', 'montana', 'nebraska', 'nevada', 'ohio', 'oklahoma', 'oregon', 'pennsylvania', 'tennessee', 'texas', 'utah', 'vermont', 'virginia', 'washington', 'wisconsin', 'wyoming']
|
33
33
|
multi_word_states = ['district of columbia', 'new hampshire', 'new jersey', 'new mexico', 'new york', 'north carolina', 'north dakota', 'puerto rico', 'rhode island', 'south carolina', 'south daktoa', 'west virginia' ]
|
34
34
|
abbreviations = ['al', 'ak', 'az', 'ar', 'ca', 'co', 'ct', 'de', 'dc', 'fl', 'ga', 'hi', 'id', 'il', 'in', 'ia', 'ks', 'ky', 'la', 'me', 'md', 'ma', 'mi', 'mn', 'ms', 'mo', 'mt', 'ne', 'nv', 'nh', 'nj', 'nm', 'ny', 'nc', 'nd', 'oh', 'ok', 'or', 'pa', 'pr', 'ri', 'sc', 'sd', 'tn', 'tx', 'ut', 'vt', 'va', 'wa', 'wv', 'wi', 'wy']
|
35
|
-
|
35
|
+
input_tokens = @input.split
|
36
36
|
|
37
37
|
multi_word_states.each { |state|
|
38
38
|
assign_state_and_abbriviation(state) and return if @input.include?(state)
|
39
39
|
}
|
40
40
|
|
41
41
|
single_word_states.each { |state|
|
42
|
-
|
42
|
+
assign_state_and_abbriviation(state) and return if input_tokens.include?(state)
|
43
43
|
}
|
44
44
|
|
45
45
|
abbreviations.each { |state|
|
46
|
-
|
46
|
+
assign_state_and_abbriviation(state) and return if input_tokens.include?(state)
|
47
47
|
}
|
48
48
|
end
|
49
49
|
|
50
50
|
def assign_state_and_abbriviation(value)
|
51
51
|
state_flashcards = { 'alabama' => 'al', 'alaska' => 'ak', 'america samoa' => 'as', 'arizona' => 'az', 'arkansas' => 'ar', 'california' => 'ca', 'colorado' => 'co', 'connecticut' => 'ct', 'delaware' => 'de', 'district of columbia' => 'dc', 'micronesia1' => 'fm', 'florida' => 'fl', 'georgia' => 'ga', 'guam' => 'gu', 'hawaii' => 'hi', 'idaho' => 'id', 'illinois' => 'il', 'indiana' => 'in', 'iowa' => 'ia', 'kansas' => 'ks', 'kentucky' => 'ky', 'louisiana' => 'la', 'maine' => 'me', 'marshall isands' => 'mh', 'maryland' => 'md', 'massachusetts' => 'ma', 'michigan' => 'mi', 'minnesota' => 'mn', 'mississippi' => 'ms', 'missouri' => 'mo', 'montana' => 'mt', 'nebraska' => 'ne', 'nevada' => 'nv', 'new hampshire' => 'nh', 'new jersey' => 'nj', 'new mexico' => 'nm', 'new york' => 'ny', 'north carolina' => 'nc', 'north dakota' => 'nd', 'ohio' => 'oh', 'oklahoma' => 'ok', 'oregon' => 'or', 'palau' => 'pw', 'pennsylvania' => 'pa', 'puerto rico' => 'pr', 'rhode island' => 'ri', 'south carolina' => 'sc', 'south dakota' => 'sd', 'tennessee' => 'tn', 'texas' => 'tx', 'utah' => 'ut', 'vermont' => 'vt', 'virgin island' => 'vi', 'virginia' => 'va', 'washington' => 'wa', 'west virginia' => 'wv', 'wisconsin' => 'wi', 'wyoming' => 'wy' }
|
52
|
-
@input.sub!(value
|
53
|
-
|
52
|
+
@input.sub!(/#{value}\b/, '') unless value.nil?
|
54
53
|
if value.length == 2
|
55
54
|
@state = state_flashcards.invert[value]
|
56
55
|
@state_abbreviation = value
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: traveller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.006
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Dreger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|