reality-naming 1.4.0 → 1.5.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: 936976f72382f6122e947cfd1819c28c33333e90
4
- data.tar.gz: 7ece37c44e828651779dfaf0aed98f6355d73d98
3
+ metadata.gz: 0d87a924fb1b43d3eabce08237b34e7cc2adc01a
4
+ data.tar.gz: 9c0fab7a2b7d35b45d10eac322cac2f8564b0c58
5
5
  SHA512:
6
- metadata.gz: fbd3abb629d56a226cb936c9c463839ec59fae8f35ec7e040f21808e08659d4429f253d658b646d55d844e9d7e0dc7413b29af0c746ce2095cef74e85a74ac0a
7
- data.tar.gz: c765750808bb317c5d62508567813e96b84d66e390050ff924b3de2bdf55552a80188cb6788f7295adc67af428ebf20908201ff1e785f72cb33a0d3739d404ce
6
+ metadata.gz: bc1b8a598c14c17a51489b03745e8c2521481db6b0e8459d7e7a35525a49dd78d6d040fc0c90b04a07647212bf97b191a9d4318bf99cedcae620fc620f1ac3a6
7
+ data.tar.gz: e2472e45c70a770af12f8bc537de8fce3eef0f6d82ac6f2110c07992ec3804b4afec0bbea44658ba20c50f429d75f2b4be7d5aaca43111bc2d39ddce8346a402
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.3.1
@@ -108,6 +108,7 @@ module Reality
108
108
 
109
109
  def split_into_words(word)
110
110
  word = word.to_s.dup
111
+ word.gsub!(/^[_-]/, '')
111
112
  word.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
112
113
  word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
113
114
  word.tr!('-', '_')
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{reality-naming}
5
- s.version = '1.4.0'
5
+ s.version = '1.5.0'
6
6
  s.platform = Gem::Platform::RUBY
7
7
 
8
8
  s.authors = ['Peter Donald']
data/test/test_naming.rb CHANGED
@@ -34,6 +34,7 @@ class TestNaming < Reality::Naming::TestCase
34
34
  assert_equal Reality::Naming.camelize('this_Is_camel_cased'), 'thisIsCamelCased'
35
35
  assert_equal Reality::Naming.camelize('EJB'), 'ejb'
36
36
  assert_equal Reality::Naming.camelize('EJBContainer'), 'ejbContainer'
37
+ assert_equal Reality::Naming.camelize('_someField'), 'someField'
37
38
 
38
39
  assert_equal Reality::Naming.pascal_case('thisIsCamelCased'), 'ThisIsCamelCased'
39
40
  assert_equal Reality::Naming.pascal_case('ThisIsCamelCased'), 'ThisIsCamelCased'
@@ -41,6 +42,7 @@ class TestNaming < Reality::Naming::TestCase
41
42
  assert_equal Reality::Naming.pascal_case('this_Is_camel_cased'), 'ThisIsCamelCased'
42
43
  assert_equal Reality::Naming.pascal_case('EJB'), 'EJB'
43
44
  assert_equal Reality::Naming.pascal_case('EJBContainer'), 'EJBContainer'
45
+ assert_equal Reality::Naming.pascal_case('_someField'), 'SomeField'
44
46
 
45
47
  assert_equal Reality::Naming.pascal_case?('FindByID'), true
46
48
 
@@ -50,6 +52,7 @@ class TestNaming < Reality::Naming::TestCase
50
52
  assert_equal Reality::Naming.underscore('this_Is_camel_cased'), 'this_is_camel_cased'
51
53
  assert_equal Reality::Naming.underscore('EJB'), 'ejb'
52
54
  assert_equal Reality::Naming.underscore('EJBContainer'), 'ejb_container'
55
+ assert_equal Reality::Naming.underscore('_someField'), 'some_field'
53
56
 
54
57
  assert_equal Reality::Naming.uppercase_constantize('thisIsCamelCased'), 'THIS_IS_CAMEL_CASED'
55
58
  assert_equal Reality::Naming.uppercase_constantize('ThisIsCamelCased'), 'THIS_IS_CAMEL_CASED'
@@ -57,6 +60,7 @@ class TestNaming < Reality::Naming::TestCase
57
60
  assert_equal Reality::Naming.uppercase_constantize('this_Is_camel_cased'), 'THIS_IS_CAMEL_CASED'
58
61
  assert_equal Reality::Naming.uppercase_constantize('EJB'), 'EJB'
59
62
  assert_equal Reality::Naming.uppercase_constantize('EJBContainer'), 'EJB_CONTAINER'
63
+ assert_equal Reality::Naming.uppercase_constantize('_someField'), 'SOME_FIELD'
60
64
 
61
65
  assert_equal Reality::Naming.xmlize('thisIsCamelCased'), 'this-is-camel-cased'
62
66
  assert_equal Reality::Naming.xmlize('ThisIsCamelCased'), 'this-is-camel-cased'
@@ -64,6 +68,7 @@ class TestNaming < Reality::Naming::TestCase
64
68
  assert_equal Reality::Naming.xmlize('this_Is_camel_cased'), 'this-is-camel-cased'
65
69
  assert_equal Reality::Naming.xmlize('EJB'), 'ejb'
66
70
  assert_equal Reality::Naming.xmlize('EJBContainer'), 'ejb-container'
71
+ assert_equal Reality::Naming.xmlize('_someField'), 'some-field'
67
72
 
68
73
  assert_equal Reality::Naming.jsonize('thisIsCamelCased'), 'thisIsCamelCased'
69
74
  assert_equal Reality::Naming.jsonize('ThisIsCamelCased'), 'thisIsCamelCased'
@@ -71,6 +76,7 @@ class TestNaming < Reality::Naming::TestCase
71
76
  assert_equal Reality::Naming.jsonize('this_Is_camel_cased'), 'thisIsCamelCased'
72
77
  assert_equal Reality::Naming.jsonize('EJB'), 'ejb'
73
78
  assert_equal Reality::Naming.jsonize('EJBContainer'), 'ejbContainer'
79
+ assert_equal Reality::Naming.jsonize('_someField'), 'someField'
74
80
  end
75
81
 
76
82
  def test_split_into_words
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.0
4
+ version: 1.5.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-11-30 00:00:00.000000000 Z
11
+ date: 2016-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -46,6 +46,7 @@ extra_rdoc_files: []
46
46
  files:
47
47
  - ".gitattributes"
48
48
  - ".gitignore"
49
+ - ".ruby-version"
49
50
  - ".travis.yml"
50
51
  - CONTRIBUTING.md
51
52
  - Gemfile