File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really
7
7
warrant a full blog post. These are mostly things I learn by pairing with
8
8
smart people at [ Hashrocket] ( http://hashrocket.com/ ) .
9
9
10
- _ 423 TILs and counting..._
10
+ _ 424 TILs and counting..._
11
11
12
12
---
13
13
@@ -303,6 +303,7 @@ _423 TILs and counting..._
303
303
- [ Destructuring Arrays In Blocks] ( ruby/destructuring-arrays-in-blocks.md )
304
304
- [ Disassemble Some Codes] ( ruby/disassemble-some-codes.md )
305
305
- [ Double Splat To Merge Hashes] ( ruby/double-splat-to-merge-hashes.md )
306
+ - [ Edit Previous Parts Of The Pry Buffer History] ( ruby/edit-previous-parts-of-the-pry-buffer-history.md )
306
307
- [ Editing Code In Pry] ( ruby/editing-code-in-pry.md )
307
308
- [ Evaluating One-Off Commands] ( ruby/evaluating-one-off-commands.md )
308
309
- [ FactoryGirl Sequences] ( ruby/factory-girl-sequences.md )
Original file line number Diff line number Diff line change
1
+ # Edit Previous Parts Of The Pry Buffer History
2
+
3
+ Each line of Ruby you enter into a Pry session is recorded with a number in
4
+ the buffer history. Pry keeps this buffer history so that you can recall
5
+ parts of it for editing and subsequent execution.
6
+
7
+ If you use the ` edit ` command by itself, Pry will open the previous Ruby
8
+ statement in your default editor. But what if you want to edit a statement
9
+ from a while back? Or even a series of statements?
10
+
11
+ Use the ` --in ` flag with ` edit ` either specifying a single record in the
12
+ buffer history or a range of records.
13
+
14
+ ``` ruby
15
+ $ pry
16
+ [1 ] pry(main)> puts " Hello"
17
+ Hello
18
+ => nil
19
+ [2 ] pry(main)> puts " World"
20
+ World
21
+ => nil
22
+ [3 ] pry(main)> puts " People"
23
+ People
24
+ => nil
25
+ [4 ] pry(main)> edit -- in 1 ..2
26
+ Hello
27
+ World
28
+ => nil
29
+ ```
You can’t perform that action at this time.
0 commit comments