Module: Kernel

Defined in:
lib/core_ext/kernel.rb

Instance Method Summary collapse

Instance Method Details

#require_all(path, relative_to: nil) ⇒ Object

Requires any ruby files in a given path.

Examples:

require_all “compile_stages”, relative_to: __FILE__




8
9
10
11
12
13
14
15
# File 'lib/core_ext/kernel.rb', line 8

def require_all(path, relative_to: nil)
  if rt = relative_to
    path = "#{File.dirname(rt)}/#{path}"
  end
  Dir.glob("#{path}/*.rb").each do |f|
    require f
  end
end