NATO 0.0.1 → 0.0.2
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/README.md +4 -1
- data/lib/NATO/dictionary.rb +1 -1
- data/lib/NATO/parser.rb +2 -2
- data/lib/NATO/version.rb +1 -1
- data/spec/parser_spec.rb +35 -0
- metadata +4 -2
data/README.md
CHANGED
data/lib/NATO/dictionary.rb
CHANGED
data/lib/NATO/parser.rb
CHANGED
@@ -8,13 +8,13 @@ class NATO::Parser
|
|
8
8
|
if is_numeric? piece
|
9
9
|
piece
|
10
10
|
else
|
11
|
-
NATO::DICTIONARY[piece.to_sym].to_s
|
11
|
+
NATO::DICTIONARY[piece.to_sym].to_s
|
12
12
|
end
|
13
13
|
end.join ' '
|
14
14
|
end
|
15
15
|
|
16
16
|
private
|
17
17
|
def is_numeric?(obj)
|
18
|
-
obj.to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/)
|
18
|
+
obj.to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/)
|
19
19
|
end
|
20
20
|
end
|
data/lib/NATO/version.rb
CHANGED
data/spec/parser_spec.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module NATO
|
4
|
+
describe Parser do
|
5
|
+
Given(:parser) { Parser.instance }
|
6
|
+
|
7
|
+
describe "#natify" do
|
8
|
+
Then { parser.should respond_to :natify }
|
9
|
+
|
10
|
+
describe "short sentence without numbers" do
|
11
|
+
When(:nato) { parser.natify 'abcde' }
|
12
|
+
|
13
|
+
Then { nato.should == 'Alfa Bravo Charlie Delta Echo' }
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "short sentence with numbers" do
|
17
|
+
When(:nato) { parser.natify '7tp3ny' }
|
18
|
+
|
19
|
+
Then { nato.should == '7 Tango Papa 3 November Yankee' }
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "medium sentence without numbers" do
|
23
|
+
When(:nato) { parser.natify 'mlozjuwswkrhf' }
|
24
|
+
|
25
|
+
Then { nato.should == 'Mike Lima Oscar Zulu Juliett Uniform Whiskey Sierra Whiskey Kilo Romeo Hotel Foxtrot' }
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "medium sentence with numbers" do
|
29
|
+
When(:nato) { parser.natify 'ml01juws846hf' }
|
30
|
+
|
31
|
+
Then { nato.should == 'Mike Lima 0 1 Juliett Uniform Whiskey Sierra 8 4 6 Hotel Foxtrot' }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: NATO
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- lib/NATO/parser.rb
|
94
94
|
- lib/NATO/text.rb
|
95
95
|
- lib/NATO/version.rb
|
96
|
+
- spec/parser_spec.rb
|
96
97
|
- spec/spec_helper.rb
|
97
98
|
- spec/text_spec.rb
|
98
99
|
homepage: https://github.com/lukelex/NATO
|
@@ -121,5 +122,6 @@ signing_key:
|
|
121
122
|
specification_version: 3
|
122
123
|
summary: NATO Phonetic Alphabet conversion tool
|
123
124
|
test_files:
|
125
|
+
- spec/parser_spec.rb
|
124
126
|
- spec/spec_helper.rb
|
125
127
|
- spec/text_spec.rb
|