Update pry

This commit is contained in:
Rico Sta. Cruz 2015-10-15 19:01:09 +08:00
parent b40e7629b1
commit 808f72f60f
1 changed files with 72 additions and 58 deletions

130
pry.md
View File

@ -6,13 +6,78 @@ layout: default
### cd
> cd Array
```
> cd Array
```
> ls
Array.methods: [] try_convert
Array#methods: & * + abbrev assoc at ...
```no-highlight
> ls
Array.methods: [] try_convert
Array#methods: & * + abbrev assoc at ...
```
> show-source
```
> show-source
```
### Code
```no-highlight
> show-method Array#select
```
### Docs
```no-highlight
> ri Array
> ri Array#each
> cd Gem
> show-doc try_activate
```
Finding
```no-highlight
> find-method each
Array#each
Array#each_index
Enumerable#each_slice
...
```
### Editing
> edit Pry#repl
### Gems
> gem-cd foo # Switch to gem's dir
> gem-install foo
> gem-list
### Misc commands
> hist # History
> wtf? # Trace of recent exception
### Rails console
Also consider [pry-rails](https://rubygems.org/gems/pry-rails).
$ pry -r ./config/environment
### Bonus: hirb
> table User.all
> view User.all
> view User.all, fields: %w[id name email]
### Rails
> show-models
> show-routes
> show-middleware
### ls
@ -31,66 +96,15 @@ layout: default
### Shell integration
shell-mode adds dir to the prompt
`shell-mode` adds dir to the prompt.
pry(main)> shell-mode
pry(main):/home/x $
Commands with `.` are shell commands
Commands with `.` are shell commands.
pry(main)> .cat hello.txt
### Code
> show-method Array#select
### Docs
> ri Array
> ri Array#each
> cd Gem
> show-doc try_activate
Finding
> find-method each
Array#each
Array#each_index
Enumerable#each_slice
...
### Editing
> edit-method Pry#repl
### Gems
> gem-cd foo # Switch to gem's dir
> gem-install foo
> gem-list
### Misc commands
> hist # History
> wtf? # Trace of recent exception
### Rails console
$ pry -r ./config/environment
### Bonus: hirb
> table User.all
> view User.all
> view User.all, fields: %w[id name email]
### Rails
> show-models
> show-routes
> show-middleware
### Reference
* [Pry](https://github.com/pry/pry)