Skip to content

Instantly share code, notes, and snippets.

@ifyouseewendy
Last active August 29, 2015 14:10
Show Gist options
  • Save ifyouseewendy/21afe1b640384a89ebca to your computer and use it in GitHub Desktop.
Save ifyouseewendy/21afe1b640384a89ebca to your computer and use it in GitHub Desktop.
pry workflow on server console
[34] pry(main)> edit -h
Usage: edit [--no-reload|--reload|--patch] [--line LINE] [--temp|--ex|FILE[:LINE]|OBJECT|--in N]
Open a text editor. When no FILE is given, edits the pry input buffer.
When a method/module/command is given, the code is opened in an editor.
Ensure `Pry.config.editor` is set to your editor of choice.
edit sample.rb edit -p MyClass#my_method
edit sample.rb --line 105 edit MyClass
edit MyClass#my_method edit --ex
edit --method edit --ex -p
https://github.com/pry/pry/wiki/Editor-integration#wiki-Edit_command
-e, --ex Open the file that raised the most recent exception (_ex_.file)
-i, --in Open a temporary file containing the Nth input expression. N may be a range
-t, --temp Open an empty temporary file
-l, --line Jump to this line in the opened file
-n, --no-reload Don't automatically reload the edited code
-c, --current Open the current __FILE__ and at __LINE__ (as returned by `whereami`)
-r, --reload Reload the edited code immediately (default for ruby files)
-p, --patch Instead of editing the object's file, try to edit in a tempfile and apply as a monkey patch
-m, --method Explicitly edit the _current_ method (when inside a method context).
-h, --help Show this message.
# edit input expressions
[35] pry(main)> edit -i 24..26
# edit in a temp file
[36] pry(main)> edit -t # :w tmp/wendi
[37] pry(main)> edit tmp/wendi
# edit exceptionss
# with pry-rescue
# running some code into Exception
[38] pry(main)> cd-cause
# or
[39] pry(main)> edit --ex
[40] pry(main)> edit --ex -p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment