 closing bracket or not."
   :type 'boolean :group 'ruby-electric)
 
+;;;###autoload
 (define-minor-mode ruby-electric-mode
   "Toggle Ruby Electric minor mode.
 With no argument, this command toggles the mode.  Non-null prefix

  "*List of contexts where matching delimiter should be
inserted. The word 'all' will do all insertions."
  :type '(set :extra-offset 8
	      (const :tag "Everything" all )
	      (const :tag "Curly brace" ?\{ )
	      (const :tag "Square brace" ?\[ )
	      (const :tag "Round brace" ?\( )
	      (const :tag "Quote" ?\' )
	      (const :tag "Double quote" ?\" )
	      (const :tag "Back quote" ?\` )
	      (const :tag "Vertical bar" ?\| ))
  :group 'ruby-electric) 

(defcustom ruby-electric-newline-before-closing-bracket nil

  (self-insert-command (prefix-numeric-value arg))
  (if (ruby-electric-space-can-be-expanded-p)
      (save-excursion
        (ruby-indent-line t)
        (newline)
        (insert "end")
        (ruby-indent-line t))))

(defun ruby-electric-code-at-point-p()
  (and ruby-electric-mode
       (let* ((properties (text-properties-at (point))))
         (and (null (memq 'font-lock-string-face properties))
              (null (memq 'font-lock-comment-face properties))))))

(defun ruby-electric-string-at-point-p()
  (and ruby-electric-mode
