Class: EventHookClientServer::Refinements::Object::BubblingConstLookup::ConstantFinder

Inherits:
Service
  • Object
show all
Defined in:
lib/event_hook_client_server/refinements/object/bubbling_const_lookup.rb

Instance Method Summary collapse

Methods inherited from Service

call

Constructor Details

#initialize(object, constant) ⇒ ConstantFinder

Returns a new instance of ConstantFinder.



10
11
12
13
# File 'lib/event_hook_client_server/refinements/object/bubbling_const_lookup.rb', line 10

def initialize(object, constant)
  @object = object
  @constant = constant
end

Instance Method Details

#callObject



15
16
17
18
19
20
21
# File 'lib/event_hook_client_server/refinements/object/bubbling_const_lookup.rb', line 15

def call
  candidates.each do |name|
    return Object.const_get(name) if Object.const_defined?(name)
  end

  nil
end