Module LineCache
In: lib/linecache.rb
lib/linecache.rb

module LineCache

Module caching lines of a file

Methods

Constants

LineCacheInfo = Struct.new(:stat, :line_numbers, :lines, :path, :sha1) unless defined?(LineCacheInfo)
LineCacheInfo = Struct.new(:stat, :line_numbers, :lines, :path, :sha1) unless defined?(LineCacheInfo)

Public Instance methods

Cache filename if it‘s not already cached. Return the expanded filename for it in the cache or nil if we can‘t find the file.

Cache filename if it‘s not already cached. Return the expanded filename for it in the cache or nil if we can‘t find the file.

Return true if filename is cached

Return true if filename is cached

Return an array of cached file names

Return an array of cached file names

Discard cache entries that are out of date. If filename is nil all entries in the file cache +@@file_cache+ are checked. If we don‘t have stat information about a file which can happen if the file was read from __SCRIPT_LINES but no corresponding file is found, it will be kept. Return a list of invalidated filenames. nil is returned if a filename was given but not found cached.

Discard cache entries that are out of date. If filename is nil all entries in the file cache +@@file_cache+ are checked. If we don‘t have stat information about a file which can happen if the file was read from __SCRIPT_LINES but no corresponding file is found, it will be kept. Return a list of invalidated filenames. nil is returned if a filename was given but not found cached.

Clear the file cache entirely.

Clear the file cache entirely.

Get line line_number from file named filename. Return nil if there was a problem. If a file named filename is not found, the function will look for it in the $: path array.

Examples:

 lines = LineCache::getline('/tmp/myfile.rb)
 # Same as above
 $: << '/tmp'
 lines = Dir.chdir('/tmp') do
    lines = LineCache::getlines ('myfile.rb')
 end

Get line line_number from file named filename. Return nil if there was a problem. If a file named filename is not found, the function will look for it in the $: path array.

Examples:

 lines = LineCache::getline('/tmp/myfile.rb)
 # Same as above
 $: << '/tmp'
 lines = Dir.chdir('/tmp') do
    lines = LineCache::getlines ('myfile.rb')
 end

Read lines of filename and cache the results. However filename was previously cached use the results from the cache. Return nil if we can‘t get lines

Read lines of filename and cache the results. However filename was previously cached use the results from the cache. Return nil if we can‘t get lines

Return full filename path for filename

Return full filename path for filename

Return SHA1 of filename.

Return SHA1 of filename.

Return the number of lines in filename

Return the number of lines in filename

Return File.stat in the cache for filename.

Return File.stat in the cache for filename.

Return an Array of breakpoints in filename. The list will contain an entry for each distinct line event call so it is possible (and possibly useful) for a line number appear more than once.

Return an Array of breakpoints in filename. The list will contain an entry for each distinct line event call so it is possible (and possibly useful) for a line number appear more than once.

Update a cache entry. If something‘s wrong, return nil. Return true if the cache was updated and false if not. If use_script_lines is true, use that as the source for the lines of the file

Update a cache entry. If something‘s wrong, return nil. Return true if the cache was updated and false if not. If use_script_lines is true, use that as the source for the lines of the file

[Validate]