traveller 0.0.009 → 0.0.010
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 +3 -3
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9db4edf73c95063662d75fa1ab04d5d1d5c77602
|
|
4
|
+
data.tar.gz: ff300739300a3d57a6a94ab09877cdc599791542
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 661bab4bb6e6f8be70ce48d3ab844c702699619701b88033b8009c185257676f609f40533aee2d23f7455c9307ee6b062b5a34baa0b808a0fb1966feb593fab2
|
|
7
|
+
data.tar.gz: 9d06e45355475e1430a48c2662ed6431432bfc062a2fd59cf02c8accf38ff76533a1d81736aa666338b01a9ed4552c32ecd8d91564251400b93e9496bd7a0726
|
data/lib/traveller.rb
CHANGED
|
@@ -12,7 +12,7 @@ class Traveller
|
|
|
12
12
|
attr_accessor :city, :state, :latitude, :longitude, :zip, :state_abbreviation
|
|
13
13
|
|
|
14
14
|
def initialize(input)
|
|
15
|
-
|
|
15
|
+
@input = input
|
|
16
16
|
@input.downcase!
|
|
17
17
|
@input.gsub!(/[,]/, '')
|
|
18
18
|
|
|
@@ -32,14 +32,14 @@ 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 dakota', '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
|
abbreviations.each { |state|
|
|
38
38
|
assign_state_and_abbriviation(state) and return if input_tokens.include?(state)
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
multi_word_states.each { |state|
|
|
42
|
-
|
|
42
|
+
assign_state_and_abbriviation(state) and return if @input.include?(state)
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
single_word_states.each { |state|
|
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.010
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- K.Q. Dreger
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2018-02-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|
|
@@ -26,13 +26,13 @@ dependencies:
|
|
|
26
26
|
version: '0'
|
|
27
27
|
description: 'Traveller parses location-based strings and exposes their city, state,
|
|
28
28
|
zip code, latitude, and longitude. NOTE: Latitude and Longitude support is coming.'
|
|
29
|
-
email:
|
|
29
|
+
email: comments@dreger.me
|
|
30
30
|
executables: []
|
|
31
31
|
extensions: []
|
|
32
32
|
extra_rdoc_files: []
|
|
33
33
|
files:
|
|
34
34
|
- lib/traveller.rb
|
|
35
|
-
homepage: https://github.com/
|
|
35
|
+
homepage: https://github.com/dreger/traveller
|
|
36
36
|
licenses:
|
|
37
37
|
- MIT
|
|
38
38
|
metadata: {}
|
|
@@ -52,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
52
52
|
version: '0'
|
|
53
53
|
requirements: []
|
|
54
54
|
rubyforge_project:
|
|
55
|
-
rubygems_version: 2.
|
|
55
|
+
rubygems_version: 2.5.1
|
|
56
56
|
signing_key:
|
|
57
57
|
specification_version: 4
|
|
58
58
|
summary: Find that location.
|