Class: DEBUGGER__::SourceRepository
Relationships & Source Files | |
Namespace Children | |
Classes:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
self,
Color
|
|
Inherits: | Object |
Defined in: | lib/debug/source_repository.rb |
Class Method Summary
- .new ⇒ SourceRepository constructor
Instance Method Summary
-
#add(iseq, src)
See additional method definition at line 20.
-
#get(iseq)
See additional method definition at line 32.
-
#get_colored(iseq)
See additional method definition at line 46.
- #initialize ⇒ SourceRepository constructor
- #add_iseq(iseq, src) private
- #add_path(path) private
- #all_iseq(iseq, rs = []) private
- #get_si(iseq) private
Color
- Included
#color_pp | See additional method definition at line 50. |
#colored_inspect, | |
#colorize | See additional method definition at line 36. |
#colorize_blue, | |
#colorize_code | See additional method definition at line 79. |
#colorize_cyan, #colorize_dim, #colorize_magenta, | |
#irb_colorize | See additional method definition at line 27. |
#with_inspection_error_guard |
Constructor Details
.new ⇒ SourceRepository
# File 'lib/debug/source_repository.rb', line 14
def initialize # cache @cmap = ObjectSpace::WeakMap.new @loaded_file_map = {} # path => nil end
#initialize ⇒ SourceRepository
# File 'lib/debug/source_repository.rb', line 61
def initialize @files = {} # filename => SrcInfo end
Instance Method Details
#add(iseq, src)
See additional method definition at line 20.
# File 'lib/debug/source_repository.rb', line 65
def add iseq, src # do nothing if (path = (iseq.absolute_path || iseq.path)) && File.exist?(path) if @loaded_file_map.has_key? path return path, true # reloaded else @loaded_file_map[path] = path return path, false end end end
#add_iseq(iseq, src) (private)
[ GitHub ]#add_path(path) (private)
[ GitHub ]#all_iseq(iseq, rs = []) (private)
[ GitHub ]# File 'lib/debug/source_repository.rb', line 77
private def all_iseq iseq, rs = [] rs << iseq iseq.each_child{|ci| all_iseq(ci, rs) } rs end
#get(iseq)
See additional method definition at line 32.
# File 'lib/debug/source_repository.rb', line 115
def get iseq return unless iseq if lines = iseq.script_lines&.map(&:chomp) lines else if (path = (iseq.absolute_path || iseq.path)) && File.exist?(path) File.readlines(path, chomp: true) else nil end end end
#get_colored(iseq)
See additional method definition at line 46.
# File 'lib/debug/source_repository.rb', line 121
def get_colored iseq if lines = @cmap[iseq] lines else if src_lines = get(iseq) @cmap[iseq] = colorize_code(src_lines.join("\n")).lines else nil end end end
#get_si(iseq) (private)
[ GitHub ]# File 'lib/debug/source_repository.rb', line 103
private def get_si iseq return unless iseq if iseq.instance_variable_defined?(:@debugger_si) iseq.instance_variable_get(:@debugger_si) elsif @files.has_key?(path = (iseq.absolute_path || iseq.path)) @files[path] elsif path add_path(path) end end