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

module LineCache

A module to read and cache lines of a Ruby program.

Methods

Constants

VERSION = '1.3.1'
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

Older routine - for compability. 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.

Older routine - for compability. 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.

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 script if it‘s not already cached.

Cache script if it‘s not already cached.

Return true if file_or_script is cached

Return true if file_or_script 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. If no filename is given clear it entirely. if a filename is given, clear just that filename.

Clear the file cache. If no filename is given clear it entirely. if a filename is given, clear just that filename.

Remove syntax-formatted lines in the cache. Use this when you change the CodeRay syntax or Token formatting and want to redo how files may have previously been syntax marked.

Remove syntax-formatted lines in the cache. Use this when you change the CodeRay syntax or Token formatting and want to redo how files may have previously been syntax marked.

Remove syntax-formatted lines in the cache. Use this when you change the CodeRay syntax or Token formatting and want to redo how files may have previously been syntax marked.

Remove syntax-formatted lines in the cache. Use this when you change the CodeRay syntax or Token formatting and want to redo how files may have previously been syntax marked.

Clear the script cache entirely.

Clear the script 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 $: array.

Examples:

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

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 $: array.

Examples:

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

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

map_file(file)

Alias for unmap_file

map_file(file)

Alias for unmap_file

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

Update a cache entry. If something is wrong, return nil. Return true if the cache was updated and false if not.

Update a cache entry. If something is wrong, return nil. Return true if the cache was updated and false if not.

[Validate]