Class: RubyDebugWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-debug-wrapper.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize ⇒ RubyDebugWrapper

Returns a new instance of RubyDebugWrapper.



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/ruby-debug-wrapper.rb', line 2

def initialize
  @gems = %w{ruby-debug ruby-debug-base columnize}
  @gems << (RUBY_VERSION > '1.9' ? 'linecache19' : 'linecache')
  if (Gem.all_load_paths - $LOAD_PATH).empty? # TODO improve bundler check
    @path = Gem.default_path
    @dir = Gem.default_dir
  else
    @path = Gem.path
    @dir = Gem.dir
  end
end

Class Method Details

.prepare ⇒ Object



25
26
27
# File 'lib/ruby-debug-wrapper.rb', line 25

def self.prepare
  self.new.prepare
end

Instance Method Details

#prepare ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/ruby-debug-wrapper.rb', line 14

def prepare
  @gems.each do |gem|
    if file = find_files(gem).first
      dir = File.dirname(file)
      $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
    else # giveup
      # abort(gem)
    end
  end
end