Module: Kernel

Defined in:
lib/locomotive/common/core_ext/kernel.rb

Instance Method Summary collapse

Instance Method Details

#require_relative_all(paths, sub = nil) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/locomotive/common/core_ext/kernel.rb', line 4

def require_relative_all(paths, sub = nil)
  main_path = File.dirname(caller.first.sub(/:\d+$/, ''))
  main_path = File.join(main_path, sub) if sub

  [*paths].each do |path|
    Dir[File.join(main_path, path, '*.rb')].each { |file| require file }
  end
end