Top Level Namespace
Defined Under Namespace
Modules: Kernel
Constant Summary collapse
- SCRIPT_LINES__ =
{}
Instance Method Summary collapse
-
#script_lines__(path) ⇒ Object
Copyright © 2011 Rocky Bernstein <[email protected]> A Rubinius implementation of set_trace_func.
Instance Method Details
#script_lines__(path) ⇒ Object
Copyright © 2011 Rocky Bernstein <[email protected]> A Rubinius implementation of set_trace_func. Compatibility with MRI 1.8 and 1.9 SCRIPT_LINES__
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/script_lines.rb', line 5 def script_lines__(path) if defined?(SCRIPT_LINES__) && SCRIPT_LINES__.is_a?(Hash) begin code_loader = Rubinius::CodeLoader.new(path) begin code_loader.resolve_load_path load_path = code_loader.instance_variable_get('@load_path') || File.(path) rescue LoadError load_path = path.dup end load_path = path[0...-'.rbc'.size] if path.end_with?('.rbc') load_path += '.rb' unless File.exist?(load_path) if File.readable?(load_path) SCRIPT_LINES__[path] = File.open(load_path).readlines puts "#{path} added to SCRIPT_LINES__" if $DEBUG end rescue end end end |