Module: Stall::Utils

Extended by:
ActiveSupport::Autoload
Defined in:
lib/stall/utils.rb,
lib/stall/utils/config_dsl.rb

Defined Under Namespace

Modules: ConfigDSL

Class Method Summary collapse

Class Method Details

.try_load_constant(name) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/stall/utils.rb', line 8

def try_load_constant(name)
  begin
    name.constantize
  rescue NameError => e
    begin
      require name.underscore
      name.constantize
    rescue LoadError, NameError => e
      nil
    end
  end
end