Module: RbDot

Defined in:
lib/rbdot.rb

Constant Summary

EXTENSIONS =
['.rb', '.so', '.o', '.dll']

Class Method Summary collapse

Class Method Details

.find_file(name) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/rbdot.rb', line 23

def find_file name
  case File.extname(name).downcase
  when *EXTENSIONS
    return name
  else
    EXTENSIONS.each do |ext|
      fn = name + ext
      $:.each do |path|
        if File.exists?(File.join(path, fn))
          return fn
        end
      end
    end
  end
  nil
end


40
41
42
43
44
45
46
47
48
49
50
# File 'lib/rbdot.rb', line 40

def register_link from_file, from_line, to
  @links ||= []
  link = {
    :from => {
              :file => RDot.get_file(from_file),
              :line => from_line
             },
    :to => find_file(to)
  }
  @links << link
end