class ActiveSupport::Editor
Public Class Methods
Returns the current editor pattern if it is known. First check for the RAILS_EDITOR environment variable, and if it’s missing, check for the EDITOR environment variable.
# 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
Registers a URL pattern for opening file in a given editor. This allows Rails to generate clickable links to control known editors.
Example:
ActiveSupport::Editor.register(“myeditor”, “myeditor://%s:%d”)
# 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