Sha256: 528d2cffc9aee402b1eb33318e8fa6610af218fbe1f9b7a687f49b423b6e88f3
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
require_relative "show_source_with_c_internals/code_fetcher" module Pry::CInternals class ShowSourceWithCInternals < Pry::Command::ShowSource def options(opt) super(opt) opt.on :c, "c-source", "Show source of a C symbol in MRI" end def show_c_source if opts.present?(:all) result, file = CodeFetcher.new(line_number_style).fetch_all_definitions(obj_name) else result, file = CodeFetcher.new(line_number_style).fetch_first_definition(obj_name) end if result set_file_and_dir_locals(file) _pry_.pager.page result else raise Pry::CommandError, no_definition_message end end def process if opts.present?(:c) && !Pry.config.skip_mri_source show_c_source return else super end rescue Pry::CommandError raise if Pry.config.skip_mri_source show_c_source end private # We can number lines with their actual line numbers # or starting with 1 (base-one) def line_number_style style = if opts.present?(:'base-one') :'base-one' elsif opts.present?(:'line-numbers') :'line-numbers' else nil end { line_number_style: style } end Pry::Commands.add_command(ShowSourceWithCInternals) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pry-doc-0.13.0pre8 | lib/pry-doc/pry_ext/show_source_with_c_internals.rb |