reality-naming 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/reality/naming.rb +7 -1
- data/reality-naming.gemspec +1 -1
- data/test/helper.rb +11 -1
- data/test/test_naming.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cebf64c05759645a560427e7c7e37b951ce9481
|
4
|
+
data.tar.gz: 9fc335ac88e45c1068e6f5160e9d05d99dd3f32a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 776ad52aa53d21e777212e220cb04f43a1ac0e72b2c8dc619620a60bdac06e42a5552127715b307641db72d27310383a9046b5ff6b5d72a1c896e511ab8ff7a1
|
7
|
+
data.tar.gz: f0eafa59ec0829f68e033a584b9a41fdc2cbe2ab7be0a0ed692d866b297e131b99f28bee436e8864442679e9372e9be36aa3df3bbaebdc92dd0c787968f9f4c1
|
data/lib/reality/naming.rb
CHANGED
@@ -118,7 +118,13 @@ module Reality
|
|
118
118
|
private
|
119
119
|
|
120
120
|
def pluralization_rules
|
121
|
-
@pluralization_rules ||=
|
121
|
+
@pluralization_rules ||= default_pluralization_rules
|
122
|
+
end
|
123
|
+
|
124
|
+
def default_pluralization_rules
|
125
|
+
rules = []
|
126
|
+
rules << Proc.new { |string| string == 'child' ? 'children' : nil }
|
127
|
+
rules
|
122
128
|
end
|
123
129
|
|
124
130
|
def last(s, limit = 1)
|
data/reality-naming.gemspec
CHANGED
data/test/helper.rb
CHANGED
@@ -4,10 +4,20 @@ require 'minitest/autorun'
|
|
4
4
|
require 'test/unit/assertions'
|
5
5
|
require 'reality/naming'
|
6
6
|
|
7
|
+
module Reality
|
8
|
+
module Naming
|
9
|
+
class << self
|
10
|
+
def reset
|
11
|
+
@pluralization_rules = nil
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
7
17
|
class Reality::Naming::TestCase < Minitest::Test
|
8
18
|
include Test::Unit::Assertions
|
9
19
|
|
10
20
|
def setup
|
11
|
-
Reality::Naming.
|
21
|
+
Reality::Naming.reset
|
12
22
|
end
|
13
23
|
end
|
data/test/test_naming.rb
CHANGED
@@ -27,6 +27,14 @@ class TestNaming < Reality::Naming::TestCase
|
|
27
27
|
assert_equal 'cats', Reality::Naming.pluralize('cat')
|
28
28
|
end
|
29
29
|
|
30
|
+
def test_default_pluralization_rules
|
31
|
+
assert_equal 'children', Reality::Naming.pluralize('child')
|
32
|
+
Reality::Naming.clear_pluralization_rules
|
33
|
+
assert_equal 'childs', Reality::Naming.pluralize('child')
|
34
|
+
Reality::Naming.reset
|
35
|
+
assert_equal 'children', Reality::Naming.pluralize('child')
|
36
|
+
end
|
37
|
+
|
30
38
|
def test_basics
|
31
39
|
assert_equal Reality::Naming.camelize('thisIsCamelCased'), 'thisIsCamelCased'
|
32
40
|
assert_equal Reality::Naming.camelize('ThisIsCamelCased'), 'thisIsCamelCased'
|
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.7.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: 2017-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|