poser 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,11 +9,11 @@ module Poser
9
9
 
10
10
  module ClassMethods
11
11
  def presenter_class
12
- Util.first_available_class [
12
+ Util.first_available_class(
13
13
  "#{self}::Presenter",
14
14
  "#{self}Presenter",
15
15
  "Poser::Presenter"
16
- ]
16
+ )
17
17
  end
18
18
  end
19
19
 
@@ -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
- camel_cased_word.constantize if camel_cased_word.respond_to?(:constantize)
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
- names = camel_cased_word.split('::')
19
- names.shift if names.empty? || names.first.empty?
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
@@ -1,3 +1,3 @@
1
1
  module Poser
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: