reality-naming 1.12.0 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 63cf5662d105e040c7f8ec7b49bb142a3457d4b5
4
- data.tar.gz: ac57769ba623ce6d3d9e491c75c41e88ffad7b81
3
+ metadata.gz: 543ab9533c5563d6997edfa56dc79b07787b602c
4
+ data.tar.gz: f2c2f4184d96927216338ce52ee182389a2c8ff8
5
5
  SHA512:
6
- metadata.gz: 7ebe9f35f603071ae722d0039c712a7b977a96aa108ec4f7a337f81fbd51d10589ecd8ac6cd1fa1828671b8456c52583c753ff923788116e216bca0a7499df71
7
- data.tar.gz: 1ceadee2b63b2781c7c4f80288f2d2cfc553265f26690829b76410eb23a8b5150623a4d625c5df94b3c78006cd41b848186b50ceb3faa1e9cf51170bec9e9bf0
6
+ metadata.gz: 6d83be2d6337ae398f7b4673bfc257229b6a6c868072359a625690fd0b9e2ed555aa68251bbf7d724ff630c85d294e9b4f165b5f44b7ce97fe01357c5998fad3
7
+ data.tar.gz: 2d4cc2d192a7b0b5a4025144a231b9a38ec637592838b4ebc12df16b1e6fdda23ebf2f16033fc886bb306140d810d0c866ea626524325cd3cd34930cae459aea
@@ -118,7 +118,7 @@ module Reality
118
118
  end
119
119
 
120
120
  def add_pluralization_rule(&block)
121
- pluralization_rules << block
121
+ pluralization_rules.unshift(block)
122
122
  end
123
123
 
124
124
  def clear_pluralization_rules
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{reality-naming}
5
- s.version = '1.12.0'
5
+ s.version = '1.13.0'
6
6
  s.platform = Gem::Platform::RUBY
7
7
 
8
8
  s.authors = ['Peter Donald']
@@ -33,6 +33,26 @@ class TestNaming < Reality::Naming::TestCase
33
33
  assert_equal 'cats', Reality::Naming.pluralize('cat')
34
34
  end
35
35
 
36
+ def test_custom_pluralization_rules_ordering
37
+ assert_equal 'cats', Reality::Naming.pluralize('cat')
38
+ Reality::Naming.add_pluralization_rule do |string|
39
+ string == 'cat' ? 'catz' : nil
40
+ end
41
+ assert_equal 'catz', Reality::Naming.pluralize('cat')
42
+ Reality::Naming.add_pluralization_rule do |string|
43
+ string == 'cat' ? 'cattles' : nil
44
+ end
45
+ assert_equal 'cattles', Reality::Naming.pluralize('cat')
46
+ end
47
+
48
+ def test_custom_pluralization_overlap_with_defaults
49
+ assert_equal 'IsAsGoodAses', Reality::Naming.pluralize('IsAsGoodAs')
50
+ Reality::Naming.add_pluralization_rule do |string|
51
+ string.to_s == 'IsAsGoodAs' ? 'IsAsGoodAsSet' : nil
52
+ end
53
+ assert_equal 'IsAsGoodAsSet', Reality::Naming.pluralize('IsAsGoodAs')
54
+ end
55
+
36
56
  def test_default_pluralization_rules
37
57
  assert_equal 'children', Reality::Naming.pluralize('child')
38
58
  assert_equal 'Children', Reality::Naming.pluralize('Child')
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.12.0
4
+ version: 1.13.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: 2018-08-07 00:00:00.000000000 Z
11
+ date: 2018-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest