Module: Defly::RequirePath

Defined in:
lib/defly/require_path.rb

Instance Method Summary collapse

Instance Method Details

#require(name, opts = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/defly/require_path.rb', line 3

def require name, opts = {}
  ret = super name
  require_path = nil

  if opts[:verbose]
    $LOAD_PATH.each do |path|
      full_path = File.join path, "#{name}.rb"

      if File.exist? full_path
        require_path = full_path
        break
      end
    end

    if require_path
      puts "Requiring #{require_path}"
    else
      puts "#{name} cannot be required"
    end
  end

  ret
end