punctuation_name 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +3 -0
- data/.rubocop.yml +30 -0
- data/.travis.yml +33 -0
- data/CHANGELOG.md +5 -0
- data/CODEOWNERS +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +85 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/punctuation_name +81 -0
- data/lib/punctuation_name/dicts/uk.rb +36 -0
- data/lib/punctuation_name/dicts/us.rb +36 -0
- data/lib/punctuation_name/version.rb +3 -0
- data/lib/punctuation_name.rb +31 -0
- data/punctuation_name.gemspec +29 -0
- metadata +106 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 684c3f5e13875e1a1d76b78ca8975d559a723728637135208c298af5882b73ad
|
4
|
+
data.tar.gz: f65a627fca39f82c93bd5e25a9cbd2e00c03045bd0940d3c889db1991bdb5753
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bb02cfe153b846d167a62bae21d2ab49df37947f947a564b1a6ccdb4732d0066302c3285f3c2c1cb2c1f4df583730b045189e79bb4c21d6355fb3be91efdc9cc
|
7
|
+
data.tar.gz: c98fadd0960ac792566a9f7ff30c47a74e2942992dd1425c3d41264d04f641eb4ecd1748e539b3848b76858ea6ee0f191d23ff8004c4542265154825d58b98b8
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
Layout/IndentationWidth:
|
2
|
+
Width: 4
|
3
|
+
|
4
|
+
Metrics/AbcSize:
|
5
|
+
Max: 50
|
6
|
+
|
7
|
+
Metrics/LineLength:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
Metrics/BlockLength:
|
11
|
+
Max: 40
|
12
|
+
|
13
|
+
Metrics/CyclomaticComplexity:
|
14
|
+
Max: 20
|
15
|
+
|
16
|
+
Metrics/MethodLength:
|
17
|
+
Max: 60
|
18
|
+
|
19
|
+
Metrics/PerceivedComplexity:
|
20
|
+
Max: 20
|
21
|
+
|
22
|
+
Style/GlobalVars:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Style/RaiseArgs:
|
26
|
+
EnforcedStyle: compact
|
27
|
+
|
28
|
+
Style/WordArray:
|
29
|
+
EnforcedStyle: brackets
|
30
|
+
|
data/.travis.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
sudo: required
|
2
|
+
matrix:
|
3
|
+
include:
|
4
|
+
- language: ruby
|
5
|
+
rvm: 2.2
|
6
|
+
before_install:
|
7
|
+
- gem install bundler -v 1.16.1
|
8
|
+
- language: ruby
|
9
|
+
rvm: 2.4.4
|
10
|
+
before_install:
|
11
|
+
- gem install bundler -v 1.17.3
|
12
|
+
- language: ruby
|
13
|
+
env: SKIP_INTERPRETER=true
|
14
|
+
rvm: 2.4.4
|
15
|
+
before_install:
|
16
|
+
- git clone https://github.com/TravisToolbox/rubocop-travis.git travis/rubocop
|
17
|
+
install:
|
18
|
+
- ./travis/rubocop/install.sh
|
19
|
+
script:
|
20
|
+
- ./travis/rubocop/scan.sh
|
21
|
+
- language: ruby
|
22
|
+
rvm: 2.2
|
23
|
+
before_install:
|
24
|
+
- mkdir travis
|
25
|
+
- git clone https://github.com/TravisToolbox/awesomebot-travis.git travis/awesomebot
|
26
|
+
install:
|
27
|
+
- ./travis/awesomebot/install.sh
|
28
|
+
script:
|
29
|
+
- ./travis/awesomebot/scan.sh
|
30
|
+
notifications:
|
31
|
+
email: false
|
32
|
+
slack:
|
33
|
+
secure: aHyur6wPDdNr+PAVuQk5UUabbTqe7IkeG61tsfqYZ0lNZ1fai293FNXZ4oi+ppLQq5snJJcqs3D2kCiHhOFjrWOeoR7wtpjPKZnsjO9kYdsRCf3O3d3auNnxUIH907X4vHLzyrQRq7/NNa5PAD3RE2i0CmDcdoQS0FaycrA0EDl4pDtUu9UQZq+KipiuakO3fJAqcve03nqzlj2JwwFnFdKkzWHEMrfqYhtnkzJ+AwS8yLGV5I6QDRHwHuW0d0Dn8dD32oXTaSJucaimy0Wj4vjWs39MdO/Ob2V9LVdxsYjg1gVmrqeShCwPm7yczhZByHpwYBmjyX2oH0k0HJ1seYzSvyAKUgorwAtCAmwLRgr459w8OJR5y3VGGtvUQ5TCKeX39laaQta++iQimnzsmchVQ+3Yto2hZ0TlvO4TluXpYBDCcQcwbo1IK4tcAvRGRJxPJd/c97POJjeOeM8WLgAP4bOAuNr2+y+0sWi8yProt9zZSDrz5vItzKC0Y5akqkVMupi/TRP/lQU7R2L1+29zNADdZAT5wJ2Ubhp4n2MVuKXwk2IPqjZuyFW3R+ryO9QQqZQITA86hYM3ypdq3iqOfDOkfLXYaow6S9cjjRsnf59vgFdjxxRF7evuxB7jRPZ4t92NSQFXSCDEeolJsWq6jMYbj/4s1aPIoRgZ/W8=
|
data/CHANGELOG.md
ADDED
data/CODEOWNERS
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at wolf@tgwolf.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Tim Gurney aka Wolf
|
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,85 @@
|
|
1
|
+
[![Build Status](https://img.shields.io/travis/WolfSoftware/punctuation_name/master.svg)](https://travis-ci.org/WolfSoftware/punctuation_name)
|
2
|
+
[![Software License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md)
|
3
|
+
[![Release](https://img.shields.io/github/release/wolfsoftware/punctuation_name.svg)](https://github.com/wolfsoftware/punctuation_name/releases/latest)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/punctuation_name.svg)](https://badge.fury.io/rb/punctuation_name)
|
5
|
+
[![Github commits (since latest release)](https://img.shields.io/github/commits-since/wolfsoftware/punctuation_name/latest.svg)](https://github.com/wolfsoftware/punctuation_name/commits)
|
6
|
+
[![GitHub repo size in bytes](https://img.shields.io/github/repo-size/wolfsoftware/punctuation_name.svg)](https://github.com/wolfsoftware/punctuation_name)
|
7
|
+
[![GitHub contributors](https://img.shields.io/github/contributors/wolfsoftware/punctuation_name.svg)](https://github.com/wolfsoftware/punctuation_name)
|
8
|
+
|
9
|
+
# Punctuation Name
|
10
|
+
|
11
|
+
A ruby gem to display the name for any given punctuation. Comes with a UK and US dictionary but you can also pass custom dictionaries.
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'punctuation_name'
|
19
|
+
```
|
20
|
+
|
21
|
+
And then execute:
|
22
|
+
|
23
|
+
$ bundle
|
24
|
+
|
25
|
+
Or install it yourself as:
|
26
|
+
|
27
|
+
$ gem install punctuation_name
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
### Simple Usage
|
32
|
+
|
33
|
+
You can use the default built in dictionary which is UK/English.
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
p = PunctuationName.new
|
37
|
+
|
38
|
+
puts p.name('!')
|
39
|
+
```
|
40
|
+
|
41
|
+
### Extended Usage
|
42
|
+
|
43
|
+
You can also use the built-in US dictionary.
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
p = PunctuationName.new
|
47
|
+
|
48
|
+
puts p.name('!', 'us')
|
49
|
+
```
|
50
|
+
|
51
|
+
### Advanced Usage
|
52
|
+
|
53
|
+
You can define your own dictionary, the below example just does a single item, but you can make the set as large as you need.
|
54
|
+
|
55
|
+
```
|
56
|
+
p = PunctuationName.new
|
57
|
+
p.custom('custom', { '!' => 'shouty marker' })
|
58
|
+
puts p.name('!', 'custom')
|
59
|
+
```
|
60
|
+
|
61
|
+
## Return Value
|
62
|
+
|
63
|
+
The gem will return the name of the punctuation if it can be found in the selected dictionary, if not the original punctuation is returned.
|
64
|
+
|
65
|
+
## Development
|
66
|
+
|
67
|
+
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.
|
68
|
+
|
69
|
+
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).
|
70
|
+
|
71
|
+
## Testing
|
72
|
+
|
73
|
+
For local testing make sure that you run `bundle exec rspec spec` and then `rake install` to install the gem locally.
|
74
|
+
|
75
|
+
## Contributing
|
76
|
+
|
77
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/WolfSoftware/punctuation_name. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
78
|
+
|
79
|
+
## License
|
80
|
+
|
81
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
82
|
+
|
83
|
+
## Code of Conduct
|
84
|
+
|
85
|
+
Everyone interacting in the PunctuationName project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/WolfSoftware/punctuation_name/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "punctuation_name"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require 'punctuation_name'
|
5
|
+
|
6
|
+
# -------------------------------------------------------------------------------- #
|
7
|
+
# Send Mssage to Slack #
|
8
|
+
# -------------------------------------------------------------------------------- #
|
9
|
+
# This function will take the input arguments and then send the message. #
|
10
|
+
# -------------------------------------------------------------------------------- #
|
11
|
+
|
12
|
+
def punctuation_name(options)
|
13
|
+
pn = PunctuationName.new
|
14
|
+
|
15
|
+
if options[:dictionary]
|
16
|
+
puts pn.name(options[:punctuation], options[:dictionary])
|
17
|
+
else
|
18
|
+
puts pn.name(options[:punctuation])
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# -------------------------------------------------------------------------------- #
|
23
|
+
# Process Arguments #
|
24
|
+
# -------------------------------------------------------------------------------- #
|
25
|
+
# This function will process the input from the command line and work out what it #
|
26
|
+
# is that the user wants to see. #
|
27
|
+
# #
|
28
|
+
# This is the main processing function where all the processing logic is handled. #
|
29
|
+
# -------------------------------------------------------------------------------- #
|
30
|
+
|
31
|
+
def process_arguments
|
32
|
+
options = {}
|
33
|
+
# Enforce the presence of
|
34
|
+
mandatory = %I[punctuation]
|
35
|
+
|
36
|
+
optparse = OptionParser.new do |opts|
|
37
|
+
opts.banner = "Usage: #{File.basename($PROGRAM_NAME)}"
|
38
|
+
|
39
|
+
opts.on('-h', '--help', 'Display this screen') do
|
40
|
+
puts opts
|
41
|
+
exit(1)
|
42
|
+
end
|
43
|
+
|
44
|
+
opts.on('-d', '--dictionary string', 'The dictionary to us') do |dictionary|
|
45
|
+
options[:dictionary] = dictionary
|
46
|
+
end
|
47
|
+
opts.on('-p', '--punctuation string', 'The punctuation to lookup') do |punctuation|
|
48
|
+
options[:punctuation] = punctuation
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
begin
|
53
|
+
optparse.parse!
|
54
|
+
missing = mandatory.select { |param| options[param].nil? }
|
55
|
+
raise OptionParser::MissingArgument.new(missing.join(', ')) unless missing.empty?
|
56
|
+
rescue OptionParser::InvalidOption, OptionParser::MissingArgument => e
|
57
|
+
puts e.to_s
|
58
|
+
puts optparse
|
59
|
+
exit(1)
|
60
|
+
end
|
61
|
+
|
62
|
+
punctuation_name(options)
|
63
|
+
end
|
64
|
+
|
65
|
+
# -------------------------------------------------------------------------------- #
|
66
|
+
# Main() #
|
67
|
+
# -------------------------------------------------------------------------------- #
|
68
|
+
# The main function where all of the heavy lifting and script config is done. #
|
69
|
+
# -------------------------------------------------------------------------------- #
|
70
|
+
|
71
|
+
def main
|
72
|
+
process_arguments
|
73
|
+
end
|
74
|
+
|
75
|
+
main
|
76
|
+
|
77
|
+
# -------------------------------------------------------------------------------- #
|
78
|
+
# End of Script #
|
79
|
+
# -------------------------------------------------------------------------------- #
|
80
|
+
# This is the end - nothing more to see here. #
|
81
|
+
# -------------------------------------------------------------------------------- #
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class PunctuationName
|
2
|
+
UK_NAMES = { '!' => 'exclamation mark',
|
3
|
+
'@' => 'at sign',
|
4
|
+
'#' => 'hash',
|
5
|
+
'£' => 'pound',
|
6
|
+
'$' => 'dollar',
|
7
|
+
'%' => 'percent',
|
8
|
+
'^' => 'carat',
|
9
|
+
'&' => 'ampersand',
|
10
|
+
'*' => 'asterisk',
|
11
|
+
'(' => 'open parenthesis',
|
12
|
+
')' => 'close parenthesis',
|
13
|
+
'-' => 'hyphen',
|
14
|
+
'_' => 'underscore',
|
15
|
+
'+' => 'plus',
|
16
|
+
'=' => 'equal sign',
|
17
|
+
'{' => 'open brace',
|
18
|
+
'}' => 'close brace',
|
19
|
+
'[' => 'open bracket',
|
20
|
+
']' => 'close bracket',
|
21
|
+
';' => 'semi colon',
|
22
|
+
':' => 'colon',
|
23
|
+
'"' => 'quote',
|
24
|
+
'|' => 'pipe',
|
25
|
+
'~' => 'tilde',
|
26
|
+
'`' => 'backtick',
|
27
|
+
'<' => 'less than',
|
28
|
+
'>' => 'greater than',
|
29
|
+
'?' => 'question mark',
|
30
|
+
',' => 'comma',
|
31
|
+
'.' => 'full stop',
|
32
|
+
'/' => 'forward slash',
|
33
|
+
' ' => 'space',
|
34
|
+
'\'' => 'apostrophe',
|
35
|
+
'\\' => 'back slash' }.freeze
|
36
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class PunctuationName
|
2
|
+
US_NAMES = { '!' => 'exclamation mark',
|
3
|
+
'@' => 'at sign',
|
4
|
+
'#' => 'hash',
|
5
|
+
'£' => 'pound',
|
6
|
+
'$' => 'dollar',
|
7
|
+
'%' => 'percent',
|
8
|
+
'^' => 'carat',
|
9
|
+
'&' => 'ampersand',
|
10
|
+
'*' => 'asterisk',
|
11
|
+
'(' => 'open parenthesis',
|
12
|
+
')' => 'close parenthesis',
|
13
|
+
'-' => 'hyphen',
|
14
|
+
'_' => 'underscore',
|
15
|
+
'+' => 'plus',
|
16
|
+
'=' => 'equal sign',
|
17
|
+
'{' => 'open brace',
|
18
|
+
'}' => 'close brace',
|
19
|
+
'[' => 'open bracket',
|
20
|
+
']' => 'close bracket',
|
21
|
+
';' => 'semi colon',
|
22
|
+
':' => 'colon',
|
23
|
+
'"' => 'quote',
|
24
|
+
'|' => 'pipe',
|
25
|
+
'~' => 'tilde',
|
26
|
+
'`' => 'backtick',
|
27
|
+
'<' => 'less than',
|
28
|
+
'>' => 'greater than',
|
29
|
+
'?' => 'question mark',
|
30
|
+
',' => 'comma',
|
31
|
+
'.' => 'period',
|
32
|
+
'/' => 'forward slash',
|
33
|
+
' ' => 'space',
|
34
|
+
'\'' => 'apostrophe',
|
35
|
+
'\\' => 'back slash' }.freeze
|
36
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'punctuation_name/version'
|
2
|
+
require 'punctuation_name/dicts/uk.rb'
|
3
|
+
require 'punctuation_name/dicts/us.rb'
|
4
|
+
|
5
|
+
#
|
6
|
+
# Add docs
|
7
|
+
#
|
8
|
+
class PunctuationName
|
9
|
+
def initialize
|
10
|
+
@dict = {}
|
11
|
+
|
12
|
+
@dict['uk'] = UK_NAMES
|
13
|
+
@dict['us'] = US_NAMES
|
14
|
+
end
|
15
|
+
|
16
|
+
def custom(name, dict)
|
17
|
+
@dict[name] = dict
|
18
|
+
end
|
19
|
+
|
20
|
+
def name_from_dictionary(punctuation, dict)
|
21
|
+
dict.key?(punctuation) ? dict[punctuation] : punctuation
|
22
|
+
end
|
23
|
+
|
24
|
+
def name(punctuation, dict_name = 'uk')
|
25
|
+
dict_name = 'uk' if dict_name.empty?
|
26
|
+
|
27
|
+
return punctuation unless @dict.key?(dict_name)
|
28
|
+
|
29
|
+
name_from_dictionary(punctuation, @dict[dict_name])
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "punctuation_name/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "punctuation_name"
|
8
|
+
spec.version = PunctuationName::VERSION
|
9
|
+
spec.authors = ["Tim Gurney aka Wolf"]
|
10
|
+
spec.email = ["wolf@tgwolf.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Display the name for any given punctuation.}
|
13
|
+
spec.description = %q{Display the name for any given punctuation. Comes with a UK and US dictionary but you can also pass custom dictionaries.}
|
14
|
+
spec.homepage = "https://github.com/WolfSoftware/punctuation_name"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
end
|
22
|
+
spec.bindir = "exe"
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: punctuation_name
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tim Gurney aka Wolf
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-01-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: Display the name for any given punctuation. Comes with a UK and US dictionary
|
56
|
+
but you can also pass custom dictionaries.
|
57
|
+
email:
|
58
|
+
- wolf@tgwolf.com
|
59
|
+
executables:
|
60
|
+
- punctuation_name
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
64
|
+
- ".gitignore"
|
65
|
+
- ".rspec"
|
66
|
+
- ".rubocop.yml"
|
67
|
+
- ".travis.yml"
|
68
|
+
- CHANGELOG.md
|
69
|
+
- CODEOWNERS
|
70
|
+
- CODE_OF_CONDUCT.md
|
71
|
+
- Gemfile
|
72
|
+
- LICENSE.txt
|
73
|
+
- README.md
|
74
|
+
- Rakefile
|
75
|
+
- bin/console
|
76
|
+
- bin/setup
|
77
|
+
- exe/punctuation_name
|
78
|
+
- lib/punctuation_name.rb
|
79
|
+
- lib/punctuation_name/dicts/uk.rb
|
80
|
+
- lib/punctuation_name/dicts/us.rb
|
81
|
+
- lib/punctuation_name/version.rb
|
82
|
+
- punctuation_name.gemspec
|
83
|
+
homepage: https://github.com/WolfSoftware/punctuation_name
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
metadata: {}
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubygems_version: 3.0.2
|
103
|
+
signing_key:
|
104
|
+
specification_version: 4
|
105
|
+
summary: Display the name for any given punctuation.
|
106
|
+
test_files: []
|