Sha256: 66495e0a8c526ac8b1db90ce1adbab731445034ef1b9f7caf577513108b94d31
Contents?: true
Size: 1.24 KB
Versions: 20
Compression:
Stored size: 1.24 KB
Contents
require 'pry/commands/show_info' class Pry class Command::ShowSource < Command::ShowInfo match 'show-source' group 'Introspection' description 'Show the source for a method or class.' banner <<-'BANNER' Usage: show-source [OPTIONS] [METH|CLASS] Aliases: $, show-method Show the source for a method or class. Tries instance methods first and then methods by default. show-source hi_method show-source hi_method show-source Pry#rep # source for Pry#rep method show-source Pry # for Pry class show-source Pry -a # for all Pry class definitions (all monkey patches) show-source Pry --super # for superclass of Pry (Object class) https://github.com/pry/pry/wiki/Source-browsing#wiki-Show_method BANNER # The source for code_object prepared for display. def content_for(code_object) raise CommandError, "Cannot locate source!" if !code_object.source Code.new(code_object.source, start_line_for(code_object)). with_line_numbers(use_line_numbers?).to_s end end Pry::Commands.add_command(Pry::Command::ShowSource) Pry::Commands.alias_command 'show-method', 'show-source' Pry::Commands.alias_command '$', 'show-source' end
Version data entries
20 entries across 20 versions & 1 rubygems