clli 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +16 -0
- data/README.md +48 -44
- data/Rakefile +1 -1
- data/clli-0.0.1.gem +0 -0
- data/lib/clli/entity_type.rb +19 -13
- data/lib/clli/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fed2fa68851679d24a3d977749614df1f254de7
|
4
|
+
data.tar.gz: e06cd436511a92e21c6cb994a7e9bcd9b42edfaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c0d085c0a98fc06961f94b622b29438fc76ed68ffee32f92c84ccd7a8f7ffcd9430968c31be24c5c54e465588c4647d8975ccd0440d90a98b2b3de52aaf9669
|
7
|
+
data.tar.gz: 830b24af359280a5fa2d2960c9369888b35be6d92e5c789203e3b49546cb93ef2583e2cac82440acb928deb2d099461b4786226f78aab1d8885c7c455ee488e5
|
data/.codeclimate.yml
ADDED
data/README.md
CHANGED
@@ -1,44 +1,48 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
$
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/clli.svg)](https://badge.fury.io/rb/clli)
|
2
|
+
[![Build Status](https://travis-ci.org/steventwheeler/clli.svg)](https://travis-ci.org/steventwheeler/clli)
|
3
|
+
[![Code Climate](https://codeclimate.com/github/steventwheeler/clli/badges/gpa.svg)](https://codeclimate.com/github/steventwheeler/clli)
|
4
|
+
|
5
|
+
# CLLI
|
6
|
+
|
7
|
+
This gem can be used to parse [Common Language Location Identification (CLLI) codes](https://en.wikipedia.org/wiki/CLLI_code). Given a CLLI this gem tries to determine the City, State/Provice, and Country the CLLI represents.
|
8
|
+
|
9
|
+
The reference for this gem is [Bell System Practices Section 795-100-100](http://etler.com/docs/BSP/795/795-100-100_I5.pdf)
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'clli'
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install clli
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
Parse a CLLI and determine the city, state, and country.
|
30
|
+
```ruby
|
31
|
+
clli = CLLI.new('MPLSMNMSDS1')
|
32
|
+
location = "#{clli.city_name}, #{clli.state_name}, #{clli.country_name}" # Minneapolis, Minnesota, United States
|
33
|
+
```
|
34
|
+
|
35
|
+
## Development
|
36
|
+
|
37
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
38
|
+
|
39
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/steventwheeler/clli.
|
44
|
+
|
45
|
+
|
46
|
+
## License
|
47
|
+
|
48
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
CHANGED
data/clli-0.0.1.gem
ADDED
Binary file
|
data/lib/clli/entity_type.rb
CHANGED
@@ -29,26 +29,32 @@ class CLLI
|
|
29
29
|
|
30
30
|
private
|
31
31
|
|
32
|
+
SWITCHING_TYPE_PATTERNS = {
|
33
|
+
"MG[#{x1}]" => %w(switching_types MGx),
|
34
|
+
"SG[#{x1}]" => %w(switching_types SGx),
|
35
|
+
"CG[#{x1}]" => %w(switching_types CGx),
|
36
|
+
"DS[#{x1}]" => %w(switching_types DSx),
|
37
|
+
"[#{n}]{2}[#{x1}]" => %w(switching_types nnx),
|
38
|
+
"[#{n}]{2}T" => %w(switching_types nnT),
|
39
|
+
"C[#{n}]T" => %w(switching_types CnT),
|
40
|
+
"B[#{n}]T" => %w(switching_types BnT),
|
41
|
+
"[#{n}]GT" => %w(switching_types nGT),
|
42
|
+
"Z[#{a}]Z" => %w(switching_types ZaZ),
|
43
|
+
"RS[#{n}]" => %w(switching_types RSn),
|
44
|
+
"X[#{a}]X" => %w(switching_types XaX),
|
45
|
+
"CT[#{x1}]" => %w(switching_types CTx)
|
46
|
+
}
|
47
|
+
|
32
48
|
##
|
33
49
|
# Determine which key to use for the parsed entity code.
|
34
50
|
#
|
35
51
|
# Params:
|
36
52
|
# +code+:: the +CLLI+ +:entity_code+ attribute value.
|
37
53
|
def code_keys(code)
|
54
|
+
SWITCHING_TYPE_PATTERNS.each do |pattern, keys|
|
55
|
+
return keys if Regexp.new(pattern) =~ code
|
56
|
+
end
|
38
57
|
case code
|
39
|
-
when Regexp.new("MG[#{x1}]") then %w(switching_types MGx)
|
40
|
-
when Regexp.new("SG[#{x1}]") then %w(switching_types SGx)
|
41
|
-
when Regexp.new("CG[#{x1}]") then %w(switching_types CGx)
|
42
|
-
when Regexp.new("DS[#{x1}]") then %w(switching_types DSx)
|
43
|
-
when Regexp.new("[#{n}]{2}[#{x1}]") then %w(switching_types nnx)
|
44
|
-
when Regexp.new("[#{n}]{2}T") then %w(switching_types nnT)
|
45
|
-
when Regexp.new("C[#{n}]T") then %w(switching_types CnT)
|
46
|
-
when Regexp.new("B[#{n}]T") then %w(switching_types BnT)
|
47
|
-
when Regexp.new("[#{n}]GT") then %w(switching_types nGT)
|
48
|
-
when Regexp.new("Z[#{a}]Z") then %w(switching_types ZaZ)
|
49
|
-
when Regexp.new("RS[#{n}]") then %w(switching_types RSn)
|
50
|
-
when Regexp.new("X[#{a}]X") then %w(switching_types XaX)
|
51
|
-
when Regexp.new("CT[#{x1}]") then %w(switching_types CTx)
|
52
58
|
when Regexp.new(switchboard_and_desk_entity_code_pattern) then ['switchboard_and_desk', code[1]]
|
53
59
|
when Regexp.new(miscellaneous_switching_termination_entity_code_pattern) then ['miscellaneous_switching_termination', code[1]]
|
54
60
|
when Regexp.new(nonswitching_entity_code_pattern) then ['nonswitching_types', code[0]]
|
data/lib/clli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Wheeler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -79,6 +79,7 @@ executables: []
|
|
79
79
|
extensions: []
|
80
80
|
extra_rdoc_files: []
|
81
81
|
files:
|
82
|
+
- ".codeclimate.yml"
|
82
83
|
- ".gitignore"
|
83
84
|
- ".rubocop.yml"
|
84
85
|
- ".travis.yml"
|
@@ -88,6 +89,7 @@ files:
|
|
88
89
|
- Rakefile
|
89
90
|
- bin/console
|
90
91
|
- bin/setup
|
92
|
+
- clli-0.0.1.gem
|
91
93
|
- clli.gemspec
|
92
94
|
- doc/795-100-100_I5.pdf
|
93
95
|
- lib/clli.rb
|