Methods

Class Public methods

current()

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.

📝 Source code
# 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
🔎 See on GitHub

register(name, url_pattern, aliases: [])

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”)

📝 Source code
# 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
🔎 See on GitHub