Class: Jeeves::ResolveCallable

Inherits:
Object
  • Object
show all
Defined in:
lib/jeeves/resolve_callable.rb

Class Method Summary collapse

Class Method Details

.call(scope, name) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/jeeves/resolve_callable.rb', line 3

def self.call(scope, name)
  class_name = camelize(name)
  if scope.const_defined?(class_name)
    callable = scope.const_get(class_name)
    callable.respond_to?(:call) ? callable : callable.new
  end
end