| Path: | README |
| Last Update: | Mon Mar 09 17:36:23 -0600 2009 |
require 'linecache'
lines = LineCache::getlines('/tmp/myruby.rb')
# The following lines have same effect as the above.
$: << '/tmp'
Dir.chdir('/tmp') {lines = LineCache::getlines('myruby.rb')
line = LineCache::getline('/tmp/myruby.rb', 6)
# Note lines[6] == line (if /tmp/myruby.rb has 6 lines)
LineCache::clear_file_cache
LineCache::clear_file_cache('/tmp/myruby.rb')
LineCache::update_cache # Check for modifications of all cached files.
This is a port of the module of the same name from the Python distribution. The idea for how TraceLineNumbers works, and some code was taken from ParseTree by Ryan Davis.
| Author: | Rocky Bernstein <rockyb@rubyforge.net> |
| License: | Copyright (c) 2007, 2008 Rocky Bernstein Released under the GNU GPL 2 license |
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
$Id: README 63 2008-03-04 22:47:26Z rockyb $