Skip to content
Browse files

Refactor function ruby-tools-to-symbol.

  • Loading branch information...
1 parent d95d9ce commit f5542d65d21ccd799789848a2f2dee49d450e1b5 @rejeep committed
Showing with 4 additions and 7 deletions.
  1. +4 −7 ruby-tools.el
View
11 ruby-tools.el
@@ -112,13 +112,10 @@
(let* ((region (ruby-tools-string-region))
(min (nth 0 region))
(max (nth 1 region))
- (region (buffer-substring-no-properties min max)))
- (if (string-match-p "^['\"][a-ZA-Z_][a-ZA-Z0-9_]+['\"]$" region)
- (save-excursion
- (delete-region min (1+ min))
- (goto-char min)
- (insert ":")
- (delete-region max (1- max)))))))
+ (content (buffer-substring-no-properties (1+ min) (1- max))))
+ (when (string-match-p "^[a-ZA-Z_][a-ZA-Z0-9_]+$" content)
+ (delete-region min max)
+ (insert (concat ":" content))))))
(defun ruby-tools-to-single-quote-string ()
(interactive)

0 comments on commit f5542d6

Please sign in to comment.
Something went wrong with that request. Please try again.