alephant-renderer 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/alephant/renderer/version.rb +1 -1
- data/lib/alephant/views.rb +9 -14
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c9953c9b606f3d11b0ff6938090d669319209a3
|
4
|
+
data.tar.gz: e98af7fee7f6c5b4bf395a626080f2548a3baadc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 327c03e516395caddc5644b987ce71ec69b80133d7d6f1e3253077cf2e81c6268dcbb32029b62d754fc6ba73d88e10de179629d85a9da687df52cb29431d2721
|
7
|
+
data.tar.gz: a7c4d64d8cf0bea9ab9c58874d0061b8ffbf9b81b38409e14a74519f2a55738f5610a5a90f730e702f803108429bd3e6cc570bb4b11fadd611b5a35d20955128
|
data/lib/alephant/views.rb
CHANGED
@@ -5,10 +5,11 @@ module Alephant
|
|
5
5
|
@@views = {}
|
6
6
|
|
7
7
|
def self.register(klass)
|
8
|
-
id =
|
9
|
-
|
8
|
+
id = self.underscorify(
|
9
|
+
klass.name.split('::').last
|
10
|
+
)
|
10
11
|
|
11
|
-
@@views[id
|
12
|
+
@@views[id] = klass
|
12
13
|
end
|
13
14
|
|
14
15
|
def self.get_registered_class(id)
|
@@ -16,17 +17,11 @@ module Alephant
|
|
16
17
|
end
|
17
18
|
|
18
19
|
def self.underscorify(str)
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
25
|
-
tr("-", "_").
|
26
|
-
downcase
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
20
|
+
str.gsub(/::/, '/').
|
21
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
22
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
23
|
+
tr("-", "_").
|
24
|
+
downcase
|
30
25
|
end
|
31
26
|
end
|
32
27
|
end
|