方法
类公共方法
current() 链接
返回当前编辑器模式(如果已知)。首先检查 RAILS_EDITOR 环境变量,如果不存在,则检查 EDITOR 环境变量。
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/editor.rb, line 28 def current if @current == false @current = if editor_name = ENV["RAILS_EDITOR"] || ENV["EDITOR"] @editors[editor_name] end end @current end
register(name, url_pattern, aliases: []) 链接
注册用于在给定编辑器中打开文件的 URL 模式。这允许 Rails 生成可点击的链接来控制已知的编辑器。
示例
ActiveSupport::Editor.register(“myeditor”, “myeditor://%s:%d”)
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/editor.rb, line 17 def register(name, url_pattern, aliases: []) editor = new(url_pattern) @editors[name] = editor aliases.each do |a| @editors[a] = editor end end