强大的开发工具 pry

https://github.com/pry/pry


非常强大。可以非常容易的查看源代码和debug

以前一直使用ruby-debug,现在有了pry更为方便了。


如下是几个常用的命令
help
cd Article
cd first
cd name
nesting
exit
ls
ls -h
ls -m
ls -M
ls Array -M
show-doc Article#in_groups_of
show-doc all
show-doc all.in_groups_of
show-method all.in_groups_of
edit-method all.in_groups_of
.ls
.cat Gemfile

debug点使用代码是
binding.pry

安装

gem install pry pry-doc
与Rails结合
#Gemfile
  gem 'pry-rails'


如何使用pry 调试 Rails

1, 安装如下几个Gem

gem 'pry-remote'
gem 'pry-nav'

2, 在项目目录下,新建.pryrc文件
Pry.commands.alias_command 'c', 'continue'
Pry.commands.alias_command 's', 'step'
Pry.commands.alias_command 'n', 'next'

就可以使用 n s n运行命令了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值