poser 1.0.0 → 1.0.1
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/lib/poser/presentable.rb +2 -2
- data/lib/poser/util.rb +10 -7
- data/lib/poser/version.rb +1 -1
- metadata +1 -1
data/lib/poser/presentable.rb
CHANGED
data/lib/poser/util.rb
CHANGED
@@ -2,7 +2,8 @@ module Poser
|
|
2
2
|
class Util
|
3
3
|
|
4
4
|
class << self
|
5
|
-
def first_available_class(class_names)
|
5
|
+
def first_available_class(*class_names)
|
6
|
+
class_names.flatten!
|
6
7
|
if class_name = class_names.shift
|
7
8
|
constantize_string class_name
|
8
9
|
end
|
@@ -13,13 +14,15 @@ module Poser
|
|
13
14
|
private
|
14
15
|
|
15
16
|
def constantize_string(camel_cased_word)
|
16
|
-
|
17
|
+
if camel_cased_word.respond_to? :constantize
|
18
|
+
camel_cased_word.constantize
|
19
|
+
else
|
20
|
+
names = camel_cased_word.split '::'
|
21
|
+
names.shift if names.empty? || names.first.empty?
|
17
22
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
names.inject(Object) do |constant, name|
|
22
|
-
constant.const_get(name, false)
|
23
|
+
names.inject(Object) do |constant, name|
|
24
|
+
constant.const_get name, false
|
25
|
+
end
|
23
26
|
end
|
24
27
|
end
|
25
28
|
end
|
data/lib/poser/version.rb
CHANGED