lite-ruby 1.0.7 → 1.0.8
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/CHANGELOG.md +5 -1
- data/Gemfile.lock +1 -1
- data/lib/lite/ruby/string.rb +22 -1
- data/lib/lite/ruby/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ba24d454323ce7e6ac1c540713424ab0a3789a7205af7d019714f5ffa489bc8
|
4
|
+
data.tar.gz: 993ceac9b653ec496415cd99cb9065a88e6879acb084d67f87f9af97a8a4bdc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f477165f75a0bea822a12664e0d68710ade1b7cb92ef22152af908a48e84b1f3cb63e3200ebe9674febf78a2854dbcbb157b69af73fc3ce3f050f449b70c7cd
|
7
|
+
data.tar.gz: 9de71665668046da66b9c6378310cd18d336f3e517c4ba7c12def2166307ca8ebed37c12a8345d9d36efec377d8ff32e24eecb188c56e0bc700d8a8adf03f866
|
data/CHANGELOG.md
CHANGED
@@ -6,9 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [1.0.8] - 2019-08-15
|
10
|
+
### Changed
|
11
|
+
- Resolve contantize name clash
|
12
|
+
|
9
13
|
## [1.0.7] - 2019-08-15
|
10
14
|
### Changed
|
11
|
-
-
|
15
|
+
- Underscore initializer file name
|
12
16
|
|
13
17
|
## [1.0.6] - 2019-08-14
|
14
18
|
### Changed
|
data/Gemfile.lock
CHANGED
data/lib/lite/ruby/string.rb
CHANGED
@@ -84,9 +84,30 @@ class String
|
|
84
84
|
camelize!
|
85
85
|
end
|
86
86
|
|
87
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
|
88
|
+
# rubocop:disable Metrics/MethodLength, Metrics/PerceivedComplexity
|
87
89
|
def constantize
|
88
|
-
|
90
|
+
names = camel_cased_word.split('::')
|
91
|
+
Object.const_get(camel_cased_word) if names.empty?
|
92
|
+
names.shift if names.size > 1 && names.first.empty?
|
93
|
+
|
94
|
+
names.inject(Object) do |constant, name|
|
95
|
+
return constant.const_get(name) if constant == Object
|
96
|
+
|
97
|
+
candidate = constant.const_get(name)
|
98
|
+
next candidate if constant.const_defined?(name, false)
|
99
|
+
next candidate unless Object.const_defined?(name)
|
100
|
+
|
101
|
+
constant = constant.ancestors.each_with_object(constant) do |ancestor, const|
|
102
|
+
break const if ancestor == Object
|
103
|
+
break ancestor if ancestor.const_defined?(name, false)
|
104
|
+
end
|
105
|
+
|
106
|
+
constant.const_get(name, false)
|
107
|
+
end
|
89
108
|
end
|
109
|
+
# rubocop:enable Metrics/MethodLength, Metrics/PerceivedComplexity
|
110
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity
|
90
111
|
|
91
112
|
def dasherize
|
92
113
|
dup.dasherize!
|
data/lib/lite/ruby/version.rb
CHANGED