Module: Rubot::Adapters

Defined in:
lib/rubot/adapters.rb

Defined Under Namespace

Modules: Aria

Class Method Summary collapse

Class Method Details

.const_missing_with_autoload(name) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rubot/adapters.rb', line 22

def const_missing_with_autoload(name)
  # TODO: Handle missing adapter without obscuring all LoadErrors.
  # begin
    req_name = "rubot/adapters/#{name.to_s.snakecase}"
    require req_name
    if const_defined? name
      return const_get(name)
    else
      raise AdapterMissingError, "Adapter #{name} not loaded by '#{req_name}'."
    end
  # rescue LoadError
  #   raise AdapterMissingError, "Adapter #{name} not found."
  # end
end