Class: Module

Inherits:
Object
  • Object
show all
Defined in:
lib/modloc/core_ext/module.rb

Instance Method Summary collapse

Instance Method Details

#source_locationsObject



3
4
5
6
7
8
9
10
11
12
# File 'lib/modloc/core_ext/module.rb', line 3

def source_locations
  found_files = $LOADED_FEATURES.select do |file|
    File.read(file) =~ source_regex rescue nil
  end
  found_files.map do |file|
    bof_match = File.read(file).match(%r{(.*\n)*#{source_regex.source}})
    line = bof_match.to_s.lines.size
    [file, line]
  end
end