modularity 0.3.1 → 0.4.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.
- data/VERSION +1 -1
- data/lib/modularity/inflector.rb +10 -7
- data/modularity.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/lib/modularity/inflector.rb
CHANGED
@@ -4,22 +4,25 @@ module Modularity
|
|
4
4
|
class Inflector
|
5
5
|
class << self
|
6
6
|
|
7
|
-
# File activesupport/lib/active_support/inflector.rb, line
|
7
|
+
# File activesupport/lib/active_support/inflector.rb, line 178
|
8
8
|
def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)
|
9
9
|
if first_letter_in_uppercase
|
10
10
|
lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
|
11
11
|
else
|
12
|
-
lower_case_and_underscored_word.first + camelize(lower_case_and_underscored_word)[1..-1]
|
12
|
+
lower_case_and_underscored_word.first.downcase + camelize(lower_case_and_underscored_word)[1..-1]
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
# File activesupport/lib/active_support/inflector.rb, line
|
16
|
+
# File activesupport/lib/active_support/inflector.rb, line 355
|
17
17
|
def constantize(camel_cased_word)
|
18
|
-
|
19
|
-
|
20
|
-
end
|
18
|
+
names = camel_cased_word.split('::')
|
19
|
+
names.shift if names.empty? || names.first.empty?
|
21
20
|
|
22
|
-
|
21
|
+
constant = Object
|
22
|
+
names.each do |name|
|
23
|
+
constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
|
24
|
+
end
|
25
|
+
constant
|
23
26
|
end
|
24
27
|
|
25
28
|
end
|
data/modularity.gemspec
CHANGED