当地历史与撬
Local history with pry
我正在为 ruby 使用 pry
REPL 及其 rails 插件(gem pry-rails
)。当前 pry
具有所有项目的全局历史记录。是否可以将其配置为每个 rails 项目都有自己的历史文件?
history 下的 Pry wiki 上有这方面的说明,这是您想要的相关部分:
Example: Put the history file in the current directory, for a separate history per-project:
Permanently (in a .pryrc file)
Pry.config.history.file = ".pry_history"
像这样创建一个新的class
class Utils
def self.pry_history
path = Pry.config.history.file
valuef = `cat -n #{path}`
print valuef
end
end
然后在你的撬控制台中你可以做
pry(main)> Utils.pry_history
我正在为 ruby 使用 pry
REPL 及其 rails 插件(gem pry-rails
)。当前 pry
具有所有项目的全局历史记录。是否可以将其配置为每个 rails 项目都有自己的历史文件?
history 下的 Pry wiki 上有这方面的说明,这是您想要的相关部分:
Example: Put the history file in the current directory, for a separate history per-project:
Permanently (in a .pryrc file)
Pry.config.history.file = ".pry_history"
像这样创建一个新的class
class Utils
def self.pry_history
path = Pry.config.history.file
valuef = `cat -n #{path}`
print valuef
end
end
然后在你的撬控制台中你可以做
pry(main)> Utils.pry_history