reality-naming 1.10.0 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitattributes +11 -5
- data/.github/ISSUE_TEMPLATE.md +45 -0
- data/CODE_OF_CONDUCT.md +73 -0
- data/CONTRIBUTING.md +27 -10
- data/lib/reality/naming.rb +37 -5
- data/reality-naming.gemspec +1 -1
- data/test/test_naming.rb +15 -9
- 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: 93affae9e11127f3ff0829c4cf41543abdaa856b
|
4
|
+
data.tar.gz: 602958900a76367f835167890474592da0efa8ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ec45873f720803cdd6a780963444234007058e2d6e772e757f87fa9816c6b39feab5e887320522b2a811bee51981993313cd1b396d5589ddff28624d7279399
|
7
|
+
data.tar.gz: aca10220b7052d4c8eb03dedd2a2afb70bf15ec3876987c0728a59a7f8413356801c734aaeeaaacb5bcc8fb5f062d7e57a808270933d08b7c2295ba9420bc6f5
|
data/.gitattributes
CHANGED
@@ -1,6 +1,12 @@
|
|
1
|
+
# DO NOT EDIT: File is auto-generated
|
1
2
|
* -text
|
2
|
-
*.
|
3
|
-
*.
|
4
|
-
*.
|
5
|
-
*.
|
6
|
-
|
3
|
+
*.gemspec text
|
4
|
+
*.md text
|
5
|
+
*.rb text
|
6
|
+
*.yml text
|
7
|
+
.gitattributes text
|
8
|
+
.gitignore text
|
9
|
+
.ruby-version text
|
10
|
+
Gemfile text
|
11
|
+
LICENSE text
|
12
|
+
Rakefile text
|
@@ -0,0 +1,45 @@
|
|
1
|
+
<!--
|
2
|
+
Thanks for your interest in the project. I appreciate bugs filed and PRs submitted!
|
3
|
+
Please make sure that you are familiar with and follow the Code of Conduct for
|
4
|
+
this project (found in the CODE_OF_CONDUCT.md file).
|
5
|
+
|
6
|
+
Please fill out this template with all the relevant information so we can
|
7
|
+
understand what's going on and fix the issue.
|
8
|
+
|
9
|
+
I may ask you to submit the fix (after giving some direction).
|
10
|
+
-->
|
11
|
+
|
12
|
+
Environment:
|
13
|
+
|
14
|
+
<!--
|
15
|
+
Please provide the version of this project where the issue occurred as well as the
|
16
|
+
versions of other environmental factors. This could be virtual machine version, os
|
17
|
+
version, browser version etc.
|
18
|
+
-->
|
19
|
+
|
20
|
+
Relevant code or config:
|
21
|
+
|
22
|
+
```
|
23
|
+
|
24
|
+
```
|
25
|
+
|
26
|
+
What you did:
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
What happened:
|
31
|
+
|
32
|
+
<!-- Please provide the full error message/screenshots/anything -->
|
33
|
+
|
34
|
+
Reproduction repository:
|
35
|
+
|
36
|
+
<!--
|
37
|
+
If possible, please create a repository that reproduces the issue with the
|
38
|
+
minimal amount of code possible.
|
39
|
+
-->
|
40
|
+
|
41
|
+
Problem description:
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
Suggested solution:
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,73 @@
|
|
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
|
+
education, socio-economic status, nationality, personal appearance, race,
|
10
|
+
religion, or sexual identity and 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 peter@realityforge.org. 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 https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
72
|
+
|
73
|
+
[homepage]: https://www.contributor-covenant.org
|
data/CONTRIBUTING.md
CHANGED
@@ -1,19 +1,34 @@
|
|
1
1
|
# How to Contribute
|
2
2
|
|
3
|
-
|
3
|
+
We'd love to accept your patches and contributions to this project. Pull requests are part of
|
4
|
+
what makes open source great. There are just a few small guidelines you need to follow.
|
4
5
|
|
5
|
-
|
6
|
-
* Create your feature branch (`git checkout -b my-new-feature`)
|
7
|
-
* Commit your changes (`git commit -am 'Add some feature'`)
|
8
|
-
* Push to the branch (`git push origin my-new-feature`)
|
9
|
-
* Create new Pull Request
|
6
|
+
## Code of Conduct
|
10
7
|
|
11
|
-
|
8
|
+
Participation in this project comes under the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md)
|
9
|
+
|
10
|
+
## Submitting code via Pull Requests
|
11
|
+
|
12
|
+
- We follow the [Github Pull Request Model](https://help.github.com/articles/about-pull-requests/) for
|
13
|
+
all contributions.
|
14
|
+
- For large bodies of work, we recommend creating an issue outlining the feature that you wish to build,
|
15
|
+
and describing how it will be implemented. This gives a chance for review to happen early, and ensures
|
16
|
+
no wasted effort occurs.
|
17
|
+
- All submissions, will require review before being merged.
|
18
|
+
- Finally - *Thanks* for considering submitting code to the project!
|
19
|
+
|
20
|
+
## Formatting
|
21
|
+
|
22
|
+
When submitting pull requests, make sure to do the following:
|
23
|
+
|
24
|
+
- Maintain the same code style as the rest of the project.
|
25
|
+
- Remove trailing whitespace. Many editors will do this automatically.
|
26
|
+
- Ensure any new files have [a trailing newline](https://stackoverflow.com/questions/5813311/no-newline-at-end-of-file)
|
12
27
|
|
13
28
|
## How to speed the merging of pull requests
|
14
29
|
|
15
|
-
* Describe your changes in the CHANGELOG.
|
16
|
-
* Give yourself some credit in the appropriate place (usually the CHANGELOG).
|
30
|
+
* Describe your changes in the CHANGELOG.md (if present).
|
31
|
+
* Give yourself some credit in the appropriate place (usually the CHANGELOG.md).
|
17
32
|
* Make commits of logical units.
|
18
33
|
* Ensure your commit messages help others understand what you are doing and why.
|
19
34
|
* Check for unnecessary whitespace with `git diff --check` before committing.
|
@@ -23,4 +38,6 @@ Pester us if we don't get your Pull Requests merged in a timely fashion. :)
|
|
23
38
|
## Additional Resources
|
24
39
|
|
25
40
|
* [General GitHub documentation](http://help.github.com/)
|
26
|
-
* [
|
41
|
+
* [How to write a good Git Commit message](https://chris.beams.io/posts/git-commit/) -
|
42
|
+
Great way to make sure your Pull Requests get accepted.
|
43
|
+
* [An Open Source Etiquette Guidebook](https://css-tricks.com/open-source-etiquette-guidebook/#article-header-id-1)
|
data/lib/reality/naming.rb
CHANGED
@@ -106,10 +106,14 @@ module Reality
|
|
106
106
|
plural = "#{singular[0, length - 1]}ves" unless singular =~ /[aeiou][aeiou]f$/
|
107
107
|
elsif last_2ch == 'fe'
|
108
108
|
plural = "#{singular[0, length - 2]}ves"
|
109
|
-
elsif %w(
|
109
|
+
elsif %w(is).include?(last_2ch)
|
110
110
|
plural = "#{singular[0, length - 2]}es"
|
111
|
-
elsif %w(
|
112
|
-
plural = "#{singular[0, length -
|
111
|
+
elsif %w(on).include?(last_2ch)
|
112
|
+
plural = "#{singular[0, length - 2]}a"
|
113
|
+
elsif %w(ss ch sh).include?(last_2ch) || %w(s x z).include?(last_ch)
|
114
|
+
plural = "#{singular}es"
|
115
|
+
elsif %w(o).include?(last_ch)
|
116
|
+
plural = "#{singular}es"
|
113
117
|
end
|
114
118
|
end
|
115
119
|
plural || "#{singular}s"
|
@@ -140,8 +144,36 @@ module Reality
|
|
140
144
|
|
141
145
|
def default_pluralization_rules
|
142
146
|
rules = []
|
143
|
-
|
144
|
-
|
147
|
+
exception_map = {}
|
148
|
+
%w(sheep series species deer fish).each do |w|
|
149
|
+
w2 = w[0...1].upcase + w[1..-1]
|
150
|
+
exception_map[w] = w
|
151
|
+
exception_map[w2] = w2
|
152
|
+
end
|
153
|
+
exception_map['child'] = 'children'
|
154
|
+
exception_map['goose'] = 'geese'
|
155
|
+
exception_map['man'] = 'men'
|
156
|
+
exception_map['woman'] = 'women'
|
157
|
+
exception_map['tooth'] = 'teeth'
|
158
|
+
exception_map['mouse'] = 'mice'
|
159
|
+
exception_map['foot'] = 'feet'
|
160
|
+
exception_map['person'] = 'people'
|
161
|
+
exception_map['photo'] = 'photos'
|
162
|
+
exception_map['piano'] = 'pianos'
|
163
|
+
exception_map['halo'] = 'halos'
|
164
|
+
exception_map['belief'] = 'beliefs'
|
165
|
+
exception_map['chef'] = 'chefs'
|
166
|
+
exception_map['chief'] = 'chiefs'
|
167
|
+
exception_map['fez'] = 'fezzes'
|
168
|
+
exception_map['gas'] = 'gasses'
|
169
|
+
exception_map['cactus'] = 'cacti'
|
170
|
+
exception_map['focus'] = 'foci'
|
171
|
+
|
172
|
+
exception_map.dup.each_pair do |k, v|
|
173
|
+
exception_map[k[0...1].upcase + k[1..-1]] = v[0...1].upcase + v[1..-1]
|
174
|
+
end
|
175
|
+
|
176
|
+
rules << Proc.new { |string| exception_map[string] }
|
145
177
|
rules
|
146
178
|
end
|
147
179
|
|
data/reality-naming.gemspec
CHANGED
data/test/test_naming.rb
CHANGED
@@ -6,24 +6,30 @@ class TestNaming < Reality::Naming::TestCase
|
|
6
6
|
assert_equal 'cats', Reality::Naming.pluralize(:cat)
|
7
7
|
assert_equal 'poppies', Reality::Naming.pluralize('poppy')
|
8
8
|
assert_equal 'says', Reality::Naming.pluralize('say')
|
9
|
-
assert_equal '
|
9
|
+
assert_equal 'fooes', Reality::Naming.pluralize('foo')
|
10
|
+
assert_equal 'dispatches', Reality::Naming.pluralize('dispatch')
|
11
|
+
assert_equal 'bushes', Reality::Naming.pluralize('bush')
|
12
|
+
assert_equal 'losses', Reality::Naming.pluralize('loss')
|
13
|
+
assert_equal 'boxes', Reality::Naming.pluralize('box')
|
14
|
+
assert_equal 'blitzes', Reality::Naming.pluralize('blitz')
|
15
|
+
assert_equal 'trusses', Reality::Naming.pluralize('truss')
|
16
|
+
assert_equal 'buses', Reality::Naming.pluralize('bus')
|
17
|
+
assert_equal 'marshes', Reality::Naming.pluralize('marsh')
|
18
|
+
assert_equal 'potatoes', Reality::Naming.pluralize('potato')
|
19
|
+
assert_equal 'tomatoes', Reality::Naming.pluralize('tomato')
|
20
|
+
assert_equal 'analyses', Reality::Naming.pluralize('analysis')
|
21
|
+
assert_equal 'ellipses', Reality::Naming.pluralize('ellipsis')
|
22
|
+
assert_equal 'phenomena', Reality::Naming.pluralize('phenomenon')
|
23
|
+
assert_equal 'criteria', Reality::Naming.pluralize('criterion')
|
10
24
|
end
|
11
25
|
|
12
26
|
def test_custom_pluralization_rules
|
13
|
-
assert_equal 'heros', Reality::Naming.pluralize('hero')
|
14
|
-
assert_equal 'cats', Reality::Naming.pluralize('cat')
|
15
|
-
Reality::Naming.add_pluralization_rule do |string|
|
16
|
-
string == 'hero' ? 'heroes' : nil
|
17
|
-
end
|
18
|
-
assert_equal 'heroes', Reality::Naming.pluralize('hero')
|
19
27
|
assert_equal 'cats', Reality::Naming.pluralize('cat')
|
20
28
|
Reality::Naming.add_pluralization_rule do |string|
|
21
29
|
string == 'cat' ? 'catz' : nil
|
22
30
|
end
|
23
|
-
assert_equal 'heroes', Reality::Naming.pluralize('hero')
|
24
31
|
assert_equal 'catz', Reality::Naming.pluralize('cat')
|
25
32
|
Reality::Naming.clear_pluralization_rules
|
26
|
-
assert_equal 'heros', Reality::Naming.pluralize('hero')
|
27
33
|
assert_equal 'cats', Reality::Naming.pluralize('cat')
|
28
34
|
end
|
29
35
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reality-naming
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Donald
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -45,9 +45,11 @@ extensions: []
|
|
45
45
|
extra_rdoc_files: []
|
46
46
|
files:
|
47
47
|
- ".gitattributes"
|
48
|
+
- ".github/ISSUE_TEMPLATE.md"
|
48
49
|
- ".gitignore"
|
49
50
|
- ".ruby-version"
|
50
51
|
- ".travis.yml"
|
52
|
+
- CODE_OF_CONDUCT.md
|
51
53
|
- CONTRIBUTING.md
|
52
54
|
- Gemfile
|
53
55
|
- LICENSE
|