class Pry::Command::ShowSource - pry-0.10.1 Documentation

# class Pry::Command::ShowSource

### Public Instance Methods

content_for(code_object) click to toggle source

The source for code_object prepared for display.

    # File lib/pry/commands/show_source.rb, line 41
    def content_for(code_object)
      Code.new(code_object.source, start_line_for(code_object)).
        with_line_numbers(use_line_numbers?).highlighted
    end

options(opt) click to toggle source
Calls superclass method Pry::Command::ShowInfo#options

    # File lib/pry/commands/show_source.rb, line 27
    def options(opt)
      opt.on :e, :eval, "evaluate the command's argument as a ruby expression and show the class its return value"
      super(opt)
    end

process() click to toggle source
Calls superclass method Pry::Command::ShowInfo#process

    # File lib/pry/commands/show_source.rb, line 32
    def process
      if opts.present?(:e)
        obj = target.eval(args.first)
        self.args = Array.new(1) { Module === obj ? obj.name : obj.class.name }
      end
      super
    end