- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
我正在尝试自定义我的 Pry(使用 Pry 有一段时间了,但这是我第一次尝试创建命令。)我想创建一个自定义命令,它将获取最后五十个项目根据我的历史,我正在构建它:
Pry::Commands.block_command "fifty", "List the last fifty inputs" do
hist --tail=50 -a
end
一旦它出现在我的 .pryrc 文件中,它就会显示我是否“帮助五十”,但如果我尝试运行命令,我会得到以下信息:
NameError: undefined local variable or method `a' for #<#<Class:0x007f8a1ee49aa8>:0x007f8a1e873ed0>
我的猜测是命令在执行 block 中的范围存在一些问题,但我对 Pry 文档的搜索没有给我任何关于如何继续的想法。其他不尝试复制 Pry cl 命令的命令,例如示例中的命令
Pry::Commands.block_command "hello", "Say hello to three people" do |x, y, z|
output.puts "hello there #{x}, #{y}, and #{z}!"
end
工作正常。感谢任何输入。
最佳答案
你错过了 run
这是运行其他 pry
命令所必需的:
Pry::Commands.block_command 'fifty', 'List the last fifty inputs' do |x|
run 'hist --tail=50 -a'
end
关于ruby - 尝试在自定义 pry 命令中运行 pry 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52611949/
调用pry 和调用binding.pry 有什么区别?例如: require 'pry' class Bookshop def initialize(book) @books = []
如果遇到异常(例如,如果您只是在脚本末尾放置一个 undefined variable “x”),Pry 会进入交互模式。 (此外,如果在脚本本身内您需要'pry' 并将binding.pry 放在您
我正在尝试自定义我的 Pry(使用 Pry 有一段时间了,但这是我第一次尝试创建命令。)我想创建一个自定义命令,它将获取最后五十个项目根据我的历史,我正在构建它: Pry::Commands.bloc
pry gem 和 pry-rails gem 有什么区别(在实现方面)? 最佳答案 比较它们的实现没有意义,因为它们是两个不同的东西:一个 IRb 替代品和一个使前者成为 Rails 控制台的插件。
我正在使用 pry-byebug 并且想这样写: 3.times do |i| next if i == 2 p i end 但这失败并出现错误: [1] pry(main)* next
每当我在命令行中输入 pry 时,它都会打开并显示此错误。 terminal$ pry NameError: uninitialized constant Pry::BondCompl
我正在尝试调试一个简单的 ruby 控制台脚本,但在尝试要求 pry 时出现加载错误: 我正在使用 rbenv 来管理环境。 我使用的是 Ruby 版本:2.3.1. 尝试使用 Pry '~> 0
为什么我会收到此 pry 动错误? [36] pry(main)> s = "pry" Error: Cannot find local context. Did you use `binding.p
当一个在rails-application文件夹中时,为什么不一样 $demo_app> pry -r ./config/environment 来自 $demo_app> pry -r config
我正在将我的应用程序的最新版本上传到 Windows 商店,但我的应用程序抛出错误: Package acceptance validation error: We encountered a fat
需要 pry在我的 RSpec spec_helper.rb运行我的规范给了我一堆警告。我该如何摆脱这些? /Library/Ruby/Gems/2.0.0/gems/pry-0.10.0/lib/p
我有 qt 项目 proj1,它依赖于另一个 (proj2)。 目录树是这样的: common/ `--/pr1/ proj1.pri ma
我是 Elixir 的新手,但玩得很开心! 我来自 Ruby 世界,所以开始寻找类比。并且存在调试工具pry。使用 binding.pry 我可以中断任何 session 。我在 Elixir 中发现
我从理解计算 一书中获得了以下代码。目的是改变 inspect 行为。 class Number >" end def to_s value.to_s end end 当我使用 i
当我在 pry 中使用 Tempfile 类时,我没有使用 require 它。 % pry -f pry(main)> Tempfile Tempfile 但是当在 irb 中时,我必须首先要求
我的工作站: $ uname -a Linux dsktop 3.13.0-77-generic #121-Ubuntu SMP Wed Jan 20 10:50:42 UTC 2016 x86_64
我把 binding.pry 放在我的脚本中, 但是现在当它停在断点处时, 是向我显示该信息。 出乎我的意料,如何解决? 帧数:0/11 From: /Users/me/.rbenv/versions
在 Rails 中使用 Pry,当我在代码中遇到断点时 绑定(bind).pry 我想知道我是怎么到这里的,谁给我打电话,谁给他们打电话等等。但奇怪的是我没有看到那个命令。有人知道吗? 最佳答案 要在
我想使用 IEx.pry 在我的 elixir 代码中一步一步地进行,比如 ruby 中的 byebug 或 Java 中的调试点。我尝试查看此处的文档:https://github.com/el
qmake 的*.pro 和*.pri 配置文件有什么区别? *.pro 文件中应包含哪些内容,*.pri 文件中应包含哪些内容? 最佳答案 它们的目标重用之间有一个主要区别: .pro 这通常称为项
我是一名优秀的程序员,十分优秀!