1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

version 0.8.3, added edit-method and updated documention for edit-method

This commit is contained in:
John Mair 2011-04-26 04:17:20 +12:00
parent 021ed2bb59
commit 9ba396bb54
3 changed files with 68 additions and 40 deletions

View file

@ -11,6 +11,7 @@ these include:
* Source code browsing (including core C source with the pry-doc gem)
* Documentation browsing
* Live help system
* Open methods in editors (`edit-method Class#method`)
* Syntax highlighting
* Command shell integration (start editors, run git, and rake from within Pry)
* Gist integration
@ -410,7 +411,26 @@ code for the `Symbol#to_proc` method to github:
https://gist.github.com/5332c38afc46d902ce46
pry(main)>
You can see the actual gist generated here: https://gist.github.com/5332c38afc46d902ce46
You can see the actual gist generated here: [https://gist.github.com/5332c38afc46d902ce46](https://gist.github.com/5332c38afc46d902ce46)
### Edit methods
You can use `edit-method Class#method` or `edit-method my_method`
(if the method is in scope) to open a method for editing directly in
your favorite editor. Pry has knowledge of a few different editors and
will attempt to open the file at the line the method is defined.
You can set the editor to use by assigning to the `Pry.editor=`
accessor. `Pry.editor` will default to `$EDITOR` or failing that will
use `nano` as the backup default. The file that is edited will be
automatically reloaded after exiting the editor - reloading can be
suppressed by passing the --no-reload option to `edit-method`
In the example below we will set our default editor to "emacsclient"
and open the `Pry#repl` method for editing:
pry(main)> Pry.editor = "emacsclient"
pry(main)> edit-method Pry#repl
### Live Help System

View file

@ -206,6 +206,14 @@ class Pry
end
end
def self.default_editor_for_platform
if RUBY_PLATFORM =~ /mswin|mingw/
ENV['EDITOR'] ? ENV['EDITOR'] : "notepad"
else
ENV['EDITOR'] ? ENV['EDITOR'] : "nano"
end
end
# Set all the configurable options back to their default values
def self.reset_defaults
@input = Readline
@ -221,7 +229,7 @@ class Pry
@should_load_rc = true
@rc_loaded = false
@cli = false
@editor = ENV['EDITOR'] ? ENV['EDITOR'] : "nano"
@editor = default_editor_for_platform
end
self.reset_defaults

View file

@ -1,3 +1,3 @@
class Pry
VERSION = "0.8.2"
VERSION = "0.8.3"
end