Sha256: e59b7a4cf0ef07f9ca8f71ab71ff7bbf08d353ad08a27682befe3b9820edb08a

Contents?: true

Size: 1.12 KB

Versions: 11

Compression:

Stored size: 1.12 KB

Contents

class Pry
  module DefaultCommands
    Misc = Pry::CommandSet.new do

      command "toggle-color", "Toggle syntax highlighting." do
        Pry.color = !Pry.color
        output.puts "Syntax highlighting #{Pry.color ? "on" : "off"}"
      end

      command "simple-prompt", "Toggle the simple prompt." do
        case _pry_.prompt
        when Pry::SIMPLE_PROMPT
          _pry_.pop_prompt
        else
          _pry_.push_prompt Pry::SIMPLE_PROMPT
        end
      end

      command "pry-version", "Show Pry version." do
        output.puts "Pry version: #{Pry::VERSION} on Ruby #{RUBY_VERSION}."
      end

      command "reload-method", "Reload the source file that contains the specified method" do |meth_name|
        meth = get_method_or_raise(meth_name, target, {}, :omit_help)

        if meth.source_type == :c
          raise CommandError, "Can't reload a C method."
        elsif meth.dynamically_defined?
          raise CommandError, "Can't reload an eval method."
        else
          file_name = meth.source_file
          load file_name
          output.puts "Reloaded #{file_name}."
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pry-0.9.10 lib/pry/default_commands/misc.rb
pry-0.9.10-i386-mswin32 lib/pry/default_commands/misc.rb
pry-0.9.10-i386-mingw32 lib/pry/default_commands/misc.rb
pry-0.9.10-java lib/pry/default_commands/misc.rb
pry-0.9.10pre1 lib/pry/default_commands/misc.rb
pry-0.9.10pre1-i386-mswin32 lib/pry/default_commands/misc.rb
pry-0.9.10pre1-i386-mingw32 lib/pry/default_commands/misc.rb
pry-0.9.10pre1-java lib/pry/default_commands/misc.rb
pry-0.10.pre.1-i386-mingw32 lib/pry/default_commands/misc.rb
pry-0.10.pre.1-java lib/pry/default_commands/misc.rb
pry-0.10.pre.1-i386-mswin32 lib/pry/default_commands/misc.rb