Module: SinatraAutoload

Defined in:
lib/sinatra_autoload/autoload.rb

Constant Summary collapse

@@root_path =
nil

Class Method Summary collapse

Class Method Details

.directories(*args) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/sinatra_autoload/autoload.rb', line 14

def self.directories(*args)
  return unless args
  args.each do |file_path|
    Dir[ File.join( @root_path, file_path, '/**/*.rb') ].each do |file|
      autoload File.basename(file, '.rb').classify.to_sym, file
    end
  end
end

.root_pathObject



6
7
8
# File 'lib/sinatra_autoload/autoload.rb', line 6

def self.root_path
  @@root_path
end

.root_path=(path) ⇒ Object



10
11
12
# File 'lib/sinatra_autoload/autoload.rb', line 10

def self.root_path=(path)
  @@root_path = path
end