reality-naming 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/reality/naming.rb +6 -6
- data/reality-naming.gemspec +1 -1
- data/test/test_naming.rb +23 -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: a6f1c04579b50d84834a84824751b629efc7432f
|
4
|
+
data.tar.gz: 202352ec7e69358d6a2733f081e9ed1104268997
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e7b96033b9222909a310183a8e4b798e086903d649c16add6ba7ed65be6876afbf2c717185f66e2d511d929d6ffc8dea5bec3fc94e61c24fffe647a06c1aa68
|
7
|
+
data.tar.gz: e32fcf9e9cafad2d22d1de23235d9d0dc0f9bb99f2ef97cd29ecacca850a29f63a3594301b4dda2860a69900ce87bd1b36bd45107bed52c90baac31ec862444e
|
data/lib/reality/naming.rb
CHANGED
@@ -17,7 +17,7 @@ module Reality
|
|
17
17
|
|
18
18
|
class << self
|
19
19
|
def camelize?(word)
|
20
|
-
camelize(word) == word
|
20
|
+
camelize(word) == word.to_s
|
21
21
|
end
|
22
22
|
|
23
23
|
def camelize(input_word)
|
@@ -30,7 +30,7 @@ module Reality
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def pascal_case?(word)
|
33
|
-
pascal_case(word) == word
|
33
|
+
pascal_case(word) == word.to_s
|
34
34
|
end
|
35
35
|
|
36
36
|
def pascal_case(word)
|
@@ -40,7 +40,7 @@ module Reality
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def underscore?(word)
|
43
|
-
underscore(word) == word
|
43
|
+
underscore(word) == word.to_s
|
44
44
|
end
|
45
45
|
|
46
46
|
def underscore(input_word)
|
@@ -48,7 +48,7 @@ module Reality
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def xmlize?(word)
|
51
|
-
xmlize(word) == word
|
51
|
+
xmlize(word) == word.to_s
|
52
52
|
end
|
53
53
|
|
54
54
|
def xmlize(word)
|
@@ -56,7 +56,7 @@ module Reality
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def jsonize?(word)
|
59
|
-
jsonize(word) == word
|
59
|
+
jsonize(word) == word.to_s
|
60
60
|
end
|
61
61
|
|
62
62
|
def jsonize(word)
|
@@ -64,7 +64,7 @@ module Reality
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def uppercase_constantize?(word)
|
67
|
-
uppercase_constantize(word) == word
|
67
|
+
uppercase_constantize(word) == word.to_s
|
68
68
|
end
|
69
69
|
|
70
70
|
def uppercase_constantize(word)
|
data/reality-naming.gemspec
CHANGED
data/test/test_naming.rb
CHANGED
@@ -36,6 +36,10 @@ class TestNaming < Reality::Naming::TestCase
|
|
36
36
|
assert_equal Reality::Naming.camelize('EJBContainer'), 'ejbContainer'
|
37
37
|
assert_equal Reality::Naming.camelize('_someField'), 'someField'
|
38
38
|
|
39
|
+
assert_equal Reality::Naming.camelize?('_someField'), false
|
40
|
+
assert_equal Reality::Naming.camelize?('someField'), true
|
41
|
+
assert_equal Reality::Naming.camelize?(:someField), true
|
42
|
+
|
39
43
|
assert_equal Reality::Naming.pascal_case('thisIsCamelCased'), 'ThisIsCamelCased'
|
40
44
|
assert_equal Reality::Naming.pascal_case('ThisIsCamelCased'), 'ThisIsCamelCased'
|
41
45
|
assert_equal Reality::Naming.pascal_case('this_Is_Camel_Cased'), 'ThisIsCamelCased'
|
@@ -45,6 +49,8 @@ class TestNaming < Reality::Naming::TestCase
|
|
45
49
|
assert_equal Reality::Naming.pascal_case('_someField'), 'SomeField'
|
46
50
|
|
47
51
|
assert_equal Reality::Naming.pascal_case?('FindByID'), true
|
52
|
+
assert_equal Reality::Naming.pascal_case?('findByID'), false
|
53
|
+
assert_equal Reality::Naming.pascal_case?(:FindByID), true
|
48
54
|
|
49
55
|
assert_equal Reality::Naming.underscore('thisIsCamelCased'), 'this_is_camel_cased'
|
50
56
|
assert_equal Reality::Naming.underscore('ThisIsCamelCased'), 'this_is_camel_cased'
|
@@ -54,6 +60,10 @@ class TestNaming < Reality::Naming::TestCase
|
|
54
60
|
assert_equal Reality::Naming.underscore('EJBContainer'), 'ejb_container'
|
55
61
|
assert_equal Reality::Naming.underscore('_someField'), 'some_field'
|
56
62
|
|
63
|
+
assert_equal Reality::Naming.underscore?('some_field'), true
|
64
|
+
assert_equal Reality::Naming.underscore?('someField'), false
|
65
|
+
assert_equal Reality::Naming.underscore?(:some_field), true
|
66
|
+
|
57
67
|
assert_equal Reality::Naming.uppercase_constantize('thisIsCamelCased'), 'THIS_IS_CAMEL_CASED'
|
58
68
|
assert_equal Reality::Naming.uppercase_constantize('ThisIsCamelCased'), 'THIS_IS_CAMEL_CASED'
|
59
69
|
assert_equal Reality::Naming.uppercase_constantize('this_Is_Camel_Cased'), 'THIS_IS_CAMEL_CASED'
|
@@ -62,6 +72,10 @@ class TestNaming < Reality::Naming::TestCase
|
|
62
72
|
assert_equal Reality::Naming.uppercase_constantize('EJBContainer'), 'EJB_CONTAINER'
|
63
73
|
assert_equal Reality::Naming.uppercase_constantize('_someField'), 'SOME_FIELD'
|
64
74
|
|
75
|
+
assert_equal Reality::Naming.uppercase_constantize?('EJB_CONTAINER'), true
|
76
|
+
assert_equal Reality::Naming.uppercase_constantize?('someField'), false
|
77
|
+
assert_equal Reality::Naming.uppercase_constantize?(:EJB_CONTAINER), true
|
78
|
+
|
65
79
|
assert_equal Reality::Naming.xmlize('thisIsCamelCased'), 'this-is-camel-cased'
|
66
80
|
assert_equal Reality::Naming.xmlize('ThisIsCamelCased'), 'this-is-camel-cased'
|
67
81
|
assert_equal Reality::Naming.xmlize('this_Is_Camel_Cased'), 'this-is-camel-cased'
|
@@ -70,6 +84,10 @@ class TestNaming < Reality::Naming::TestCase
|
|
70
84
|
assert_equal Reality::Naming.xmlize('EJBContainer'), 'ejb-container'
|
71
85
|
assert_equal Reality::Naming.xmlize('_someField'), 'some-field'
|
72
86
|
|
87
|
+
assert_equal Reality::Naming.xmlize?('ejb-container'), true
|
88
|
+
assert_equal Reality::Naming.xmlize?('ejbContainer'), false
|
89
|
+
assert_equal Reality::Naming.xmlize?(:'ejb-container'), true
|
90
|
+
|
73
91
|
assert_equal Reality::Naming.jsonize('thisIsCamelCased'), 'thisIsCamelCased'
|
74
92
|
assert_equal Reality::Naming.jsonize('ThisIsCamelCased'), 'thisIsCamelCased'
|
75
93
|
assert_equal Reality::Naming.jsonize('this_Is_Camel_Cased'), 'thisIsCamelCased'
|
@@ -77,6 +95,10 @@ class TestNaming < Reality::Naming::TestCase
|
|
77
95
|
assert_equal Reality::Naming.jsonize('EJB'), 'ejb'
|
78
96
|
assert_equal Reality::Naming.jsonize('EJBContainer'), 'ejbContainer'
|
79
97
|
assert_equal Reality::Naming.jsonize('_someField'), 'someField'
|
98
|
+
|
99
|
+
assert_equal Reality::Naming.jsonize?('ejbContainer'), true
|
100
|
+
assert_equal Reality::Naming.jsonize?('this_Is_Camel_Cased'), false
|
101
|
+
assert_equal Reality::Naming.jsonize?(:ejbContainer), true
|
80
102
|
end
|
81
103
|
|
82
104
|
def test_split_into_words
|
@@ -108,5 +130,6 @@ class TestNaming < Reality::Naming::TestCase
|
|
108
130
|
assert_equal result, Reality::Naming.send(method_name, :'my_support_library'), "Checking conversion to #{result}"
|
109
131
|
assert_equal result, Reality::Naming.send(method_name, :'my-support-library'), "Checking conversion to #{result}"
|
110
132
|
assert_equal Reality::Naming.send(:"#{method_name}?", result), true
|
133
|
+
assert_equal Reality::Naming.send(:"#{method_name}?", result.to_sym), true
|
111
134
|
end
|
112
135
|
end
|
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.6.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-
|
11
|
+
date: 2016-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|