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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a6f1c04579b50d84834a84824751b629efc7432f
4
- data.tar.gz: 202352ec7e69358d6a2733f081e9ed1104268997
3
+ metadata.gz: 8cebf64c05759645a560427e7c7e37b951ce9481
4
+ data.tar.gz: 9fc335ac88e45c1068e6f5160e9d05d99dd3f32a
5
5
  SHA512:
6
- metadata.gz: 5e7b96033b9222909a310183a8e4b798e086903d649c16add6ba7ed65be6876afbf2c717185f66e2d511d929d6ffc8dea5bec3fc94e61c24fffe647a06c1aa68
7
- data.tar.gz: e32fcf9e9cafad2d22d1de23235d9d0dc0f9bb99f2ef97cd29ecacca850a29f63a3594301b4dda2860a69900ce87bd1b36bd45107bed52c90baac31ec862444e
6
+ metadata.gz: 776ad52aa53d21e777212e220cb04f43a1ac0e72b2c8dc619620a60bdac06e42a5552127715b307641db72d27310383a9046b5ff6b5d72a1c896e511ab8ff7a1
7
+ data.tar.gz: f0eafa59ec0829f68e033a584b9a41fdc2cbe2ab7be0a0ed692d866b297e131b99f28bee436e8864442679e9372e9be36aa3df3bbaebdc92dd0c787968f9f4c1
@@ -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)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{reality-naming}
5
- s.version = '1.6.0'
5
+ s.version = '1.7.0'
6
6
  s.platform = Gem::Platform::RUBY
7
7
 
8
8
  s.authors = ['Peter Donald']
@@ -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.clear_pluralization_rules
21
+ Reality::Naming.reset
12
22
  end
13
23
  end
@@ -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.6.0
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: 2016-12-24 00:00:00.000000000 Z
11
+ date: 2017-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest