Class: Object

Inherits:
BasicObject
Defined in:
lib/active_acl/load_files_from.rb

Instance Method Summary collapse

Instance Method Details

#load_files_from(filenames) ⇒ Object

Loads all files it finds at the specified path - use /path/**/*.rb to load from sub directories as well

Silently fails if path is not found or an error occurs



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/active_acl/load_files_from.rb', line 7

def load_files_from(filenames)
  # don't show files that begin with . and ensure .rb ending
  cs = Dir["#{filenames}"]
  for file_name in cs.sort  
    begin
      # load file_name    
      load(file_name)
      Rails.logger.info "#{file_name} loaded"
    rescue Exception => e
      Rails.logger.warn("error loading file #{file_name}: #{e.message}")
      Rails.logger.warn(e.backtrace)
    end  
  end
end