nato_phonetic 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fb200d7c85f2941e2d96419cc688c4b2314b5e9e597627d07094f848af61fd0f
4
+ data.tar.gz: 9ce40e2f6e0365c9df5ae259c1acdcbf10f59971a81637d6d156890fbdeaea61
5
+ SHA512:
6
+ metadata.gz: a4ddbf46001e498d7503dcbee4c5cd083371121f779212337fbf7dd36df537947a2f80a0d20d78431ad21d1f5d112ed0787880a8cd970ac71c76e643ae2e4300
7
+ data.tar.gz: 2aebcfdcea916864d2224751374cd1918770709f937a3146849902f23198d6589332242db0650ede5396b717eb7e82bc63aafa99fc6483d85795e7ea0e4c54e8
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,115 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+
7
+ Style/StringLiteralsInInterpolation:
8
+ Enabled: true
9
+ EnforcedStyle: double_quotes
10
+
11
+ Layout/LineLength:
12
+ Max: 120
13
+
14
+ Gemspec/DateAssignment: # new in 1.10
15
+ Enabled: true
16
+ Gemspec/RequireMFA: # new in 1.23
17
+ Enabled: true
18
+ Layout/LineEndStringConcatenationIndentation: # new in 1.18
19
+ Enabled: true
20
+ Layout/SpaceBeforeBrackets: # new in 1.7
21
+ Enabled: true
22
+ Lint/AmbiguousAssignment: # new in 1.7
23
+ Enabled: true
24
+ Lint/AmbiguousOperatorPrecedence: # new in 1.21
25
+ Enabled: true
26
+ Lint/AmbiguousRange: # new in 1.19
27
+ Enabled: true
28
+ Lint/DeprecatedConstants: # new in 1.8
29
+ Enabled: true
30
+ Lint/DuplicateBranch: # new in 1.3
31
+ Enabled: true
32
+ Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
33
+ Enabled: true
34
+ Lint/EmptyBlock: # new in 1.1
35
+ Enabled: true
36
+ Lint/EmptyClass: # new in 1.3
37
+ Enabled: true
38
+ Lint/EmptyInPattern: # new in 1.16
39
+ Enabled: true
40
+ Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
41
+ Enabled: true
42
+ Lint/LambdaWithoutLiteralBlock: # new in 1.8
43
+ Enabled: true
44
+ Lint/NoReturnInBeginEndBlocks: # new in 1.2
45
+ Enabled: true
46
+ Lint/NumberedParameterAssignment: # new in 1.9
47
+ Enabled: true
48
+ Lint/OrAssignmentToConstant: # new in 1.9
49
+ Enabled: true
50
+ Lint/RedundantDirGlobSort: # new in 1.8
51
+ Enabled: true
52
+ Lint/RequireRelativeSelfPath: # new in 1.22
53
+ Enabled: true
54
+ Lint/SymbolConversion: # new in 1.9
55
+ Enabled: true
56
+ Lint/ToEnumArguments: # new in 1.1
57
+ Enabled: true
58
+ Lint/TripleQuotes: # new in 1.9
59
+ Enabled: true
60
+ Lint/UnexpectedBlockArity: # new in 1.5
61
+ Enabled: true
62
+ Lint/UnmodifiedReduceAccumulator: # new in 1.1
63
+ Enabled: true
64
+ Lint/UselessRuby2Keywords: # new in 1.23
65
+ Enabled: true
66
+ Naming/BlockForwarding: # new in 1.24
67
+ Enabled: true
68
+ Security/IoMethods: # new in 1.22
69
+ Enabled: true
70
+ Style/ArgumentsForwarding: # new in 1.1
71
+ Enabled: true
72
+ Style/CollectionCompact: # new in 1.2
73
+ Enabled: true
74
+ Style/DocumentDynamicEvalDefinition: # new in 1.1
75
+ Enabled: true
76
+ Style/EndlessMethod: # new in 1.8
77
+ Enabled: true
78
+ Style/FileRead: # new in 1.24
79
+ Enabled: true
80
+ Style/FileWrite: # new in 1.24
81
+ Enabled: true
82
+ Style/HashConversion: # new in 1.10
83
+ Enabled: true
84
+ Style/HashExcept: # new in 1.7
85
+ Enabled: true
86
+ Style/IfWithBooleanLiteralBranches: # new in 1.9
87
+ Enabled: true
88
+ Style/InPatternThen: # new in 1.16
89
+ Enabled: true
90
+ Style/MapToHash: # new in 1.24
91
+ Enabled: true
92
+ Style/MultilineInPatternThen: # new in 1.16
93
+ Enabled: true
94
+ Style/NegatedIfElseCondition: # new in 1.2
95
+ Enabled: true
96
+ Style/NilLambda: # new in 1.3
97
+ Enabled: true
98
+ Style/NumberedParameters: # new in 1.22
99
+ Enabled: true
100
+ Style/NumberedParametersLimit: # new in 1.22
101
+ Enabled: true
102
+ Style/OpenStructUse: # new in 1.23
103
+ Enabled: true
104
+ Style/QuotedSymbols: # new in 1.16
105
+ Enabled: true
106
+ Style/RedundantArgument: # new in 1.4
107
+ Enabled: true
108
+ Style/RedundantSelfAssignmentBranch: # new in 1.19
109
+ Enabled: true
110
+ Style/SelectByRegexp: # new in 1.22
111
+ Enabled: true
112
+ Style/StringChars: # new in 1.12
113
+ Enabled: true
114
+ Style/SwapValues: # new in 1.1
115
+ Enabled: true
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.0.1] - 2022-03-05
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at git@doew.jp. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ gem 'rake', '~> 13.0'
8
+
9
+ gem 'rspec', '~> 3.0'
10
+
11
+ gem 'rubocop', '~> 1.21'
data/Gemfile.lock ADDED
@@ -0,0 +1,55 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ nato_phonetic (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.2)
10
+ diff-lcs (1.5.0)
11
+ parallel (1.21.0)
12
+ parser (3.1.1.0)
13
+ ast (~> 2.4.1)
14
+ rainbow (3.1.1)
15
+ rake (13.0.6)
16
+ regexp_parser (2.2.1)
17
+ rexml (3.2.5)
18
+ rspec (3.11.0)
19
+ rspec-core (~> 3.11.0)
20
+ rspec-expectations (~> 3.11.0)
21
+ rspec-mocks (~> 3.11.0)
22
+ rspec-core (3.11.0)
23
+ rspec-support (~> 3.11.0)
24
+ rspec-expectations (3.11.0)
25
+ diff-lcs (>= 1.2.0, < 2.0)
26
+ rspec-support (~> 3.11.0)
27
+ rspec-mocks (3.11.0)
28
+ diff-lcs (>= 1.2.0, < 2.0)
29
+ rspec-support (~> 3.11.0)
30
+ rspec-support (3.11.0)
31
+ rubocop (1.25.1)
32
+ parallel (~> 1.10)
33
+ parser (>= 3.1.0.0)
34
+ rainbow (>= 2.2.2, < 4.0)
35
+ regexp_parser (>= 1.8, < 3.0)
36
+ rexml
37
+ rubocop-ast (>= 1.15.1, < 2.0)
38
+ ruby-progressbar (~> 1.7)
39
+ unicode-display_width (>= 1.4.0, < 3.0)
40
+ rubocop-ast (1.16.0)
41
+ parser (>= 3.1.1.0)
42
+ ruby-progressbar (1.11.0)
43
+ unicode-display_width (2.1.0)
44
+
45
+ PLATFORMS
46
+ x86_64-linux
47
+
48
+ DEPENDENCIES
49
+ nato_phonetic!
50
+ rake (~> 13.0)
51
+ rspec (~> 3.0)
52
+ rubocop (~> 1.21)
53
+
54
+ BUNDLED WITH
55
+ 2.3.8
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 doew
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # NatoPhonetic
2
+
3
+ Convert plane alphabet sentences to nato phonetic alphabet.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'nato_phonetic'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install nato_phonetic
20
+
21
+ ## Usage
22
+
23
+ ```irb
24
+ irb(main):001:0> require 'nato_phonetic'
25
+ => true
26
+ irb(main):002:0> NatoPhonetic.convert('Hello World')
27
+ => "Hotel Echo Lima Lima Oscar Whiskey Oscar Romeo Lima Delta"
28
+ irb(main):003:0> 'Hello World'.extend(NatoPhonetic).to_nato_phonetic
29
+ => "Hotel Echo Lima Lima Oscar Whiskey Oscar Romeo Lima Delta"
30
+ ```
31
+
32
+ ## Development
33
+
34
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
35
+
36
+ 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
37
+
38
+ ## Contributing
39
+
40
+ Bug reports and pull requests are welcome on GitHub at https://github.com/doew/nato_phonetic. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/doew/nato_phonetic/blob/master/CODE_OF_CONDUCT.md).
41
+
42
+ ## License
43
+
44
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
45
+
46
+ ## Code of Conduct
47
+
48
+ Everyone interacting in the NatoPhonetic project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/doew/nato_phonetic/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require 'rubocop/rake_task'
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NatoPhonetic
4
+ # Convert class to convert plane alphabet sentenses to phonetic alphabet.
5
+ class Converter
6
+ NATO_PHONETIC_ALPHABET_HASH = {
7
+ a: 'Alpha',
8
+ b: 'Bravo',
9
+ c: 'Charlie',
10
+ d: 'Delta',
11
+ e: 'Echo',
12
+ f: 'Foxtrot',
13
+ g: 'Golf',
14
+ h: 'Hotel',
15
+ i: 'India',
16
+ j: 'Juliett',
17
+ k: 'Kilo',
18
+ l: 'Lima',
19
+ m: 'Mike',
20
+ n: 'November',
21
+ o: 'Oscar',
22
+ p: 'Papa',
23
+ q: 'Quebec',
24
+ r: 'Romeo',
25
+ s: 'Sierra',
26
+ t: 'Tango',
27
+ u: 'Uniform',
28
+ v: 'Victor',
29
+ w: 'Whiskey',
30
+ x: 'X-ray',
31
+ y: 'Yankee',
32
+ z: 'Zulu',
33
+ '0': 'Zero',
34
+ '1': 'One',
35
+ '2': 'Two',
36
+ '3': 'Three',
37
+ '4': 'Four',
38
+ '5': 'Five',
39
+ '6': 'Six',
40
+ '7': 'Seven',
41
+ '8': 'Eight',
42
+ '9': 'Nine'
43
+ }.freeze
44
+
45
+ def initialize(str)
46
+ @raw_input = str
47
+ end
48
+
49
+ def convert
50
+ @phonetic = ''
51
+ @raw_input.each_char do |c|
52
+ if phonetic = NATO_PHONETIC_ALPHABET_HASH[:"#{c.downcase}"] # rubocop:disable Lint/AssignmentInCondition
53
+ @phonetic += "#{phonetic} "
54
+ end
55
+ end
56
+ @phonetic.delete_suffix! ' '
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NatoPhonetic
4
+ VERSION = '0.1.0'
5
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'nato_phonetic/version'
4
+ require_relative 'nato_phonetic/converter'
5
+
6
+ # All parent module
7
+ module NatoPhonetic
8
+ def convert(str)
9
+ NatoPhonetic::Converter.new(str).convert
10
+ end
11
+
12
+ def to_nato_phonetic
13
+ NatoPhonetic::Converter.new(self).convert
14
+ end
15
+
16
+ module_function :convert
17
+
18
+ class Error < StandardError; end
19
+ # Your code goes here...
20
+ end
@@ -0,0 +1,4 @@
1
+ module NatoPhonetic
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nato_phonetic
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - doew
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-03-05 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Some tools to get converted NATO phonetic alphabet from input.
14
+ email:
15
+ - git@doew.jp
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".rspec"
21
+ - ".rubocop.yml"
22
+ - CHANGELOG.md
23
+ - CODE_OF_CONDUCT.md
24
+ - Gemfile
25
+ - Gemfile.lock
26
+ - LICENSE.txt
27
+ - README.md
28
+ - Rakefile
29
+ - lib/nato_phonetic.rb
30
+ - lib/nato_phonetic/converter.rb
31
+ - lib/nato_phonetic/version.rb
32
+ - sig/nato_phonetic.rbs
33
+ homepage: https://github.com/doew/nato_phonetic
34
+ licenses:
35
+ - MIT
36
+ metadata:
37
+ homepage_uri: https://github.com/doew/nato_phonetic
38
+ source_code_uri: https://github.com/doew/nato_phonetic
39
+ changelog_uri: https://github.com/doew/nato_phonetic/CHANGELOG.md
40
+ rubygems_mfa_required: 'true'
41
+ post_install_message:
42
+ rdoc_options: []
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 2.6.0
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ requirements: []
56
+ rubygems_version: 3.3.7
57
+ signing_key:
58
+ specification_version: 4
59
+ summary: To get converted NATO phonetic alphabet from input.
60
+ test_files: []