From ac26e57ad152f71fbbb7a00468213ab1b7cbeb60 Mon Sep 17 00:00:00 2001 From: John Mair Date: Wed, 29 Feb 2012 03:03:41 +1300 Subject: [PATCH] improve rbx core source support * Making use of new Rubinius::LIB_PATH and Rubinius::KERNEL_PATH constants --- lib/pry/rbx_path.rb | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/lib/pry/rbx_path.rb b/lib/pry/rbx_path.rb index bb3520bc..b3d4fa01 100644 --- a/lib/pry/rbx_path.rb +++ b/lib/pry/rbx_path.rb @@ -2,33 +2,19 @@ class Pry module RbxPath module_function def is_core_path?(path) - path.start_with?("kernel") + path.start_with?("kernel") || path.start_with?("lib") end def convert_path_to_full(path) - if rvm_ruby?(Rubinius::BIN_PATH) - rvm_convert_path_to_full(path) - else - std_convert_path_to_full(path) + if path.start_with?("kernel") + File.join File.dirname(Rubinius::KERNEL_PATH), path + elsif path.start_with?("lib") + File.join File.dirname(Rubinius::LIB_PATH), path end end def rvm_ruby?(path) !!(path =~ /\.rvm/) end - - def rvm_convert_path_to_full(path) - ruby_name = File.dirname(Rubinius::BIN_PATH).split("/").last - source_path = File.join(File.dirname(File.dirname(File.dirname(Rubinius::BIN_PATH))), "src", ruby_name) - file_name = File.join(source_path, path) - raise "Cannot find rbx core source" if !File.exists?(file_name) - file_name - end - - def std_convert_path_to_full(path) - file_name = File.join(Rubinius::BIN_PATH, "..", path) - raise "Cannot find rbx core source" if !File.exists?(file_name) - file_name - end end end