Class: Object

Inherits:
BasicObject
Defined in:
lib/auto_loader.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.const_missing(const) ⇒ Object



9
10
11
12
# File 'lib/auto_loader.rb', line 9

def self.const_missing(const)
  auto_load(const)
  Kernel.const_get(const)
end

Instance Method Details

#auto_load(const) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/auto_loader.rb', line 14

def auto_load(const)
  Gazebo::LOAD_PATHS.each do |dir|
    file = File.join(Gazebo::ROOT, dir, const.to_s.underscore)

    begin
      require_relative(file)
      return
    rescue LoadError => e
    end
  end
end