Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Mirroring Jacob's change in the Ruby bundle.

git-svn-id: http://svn.textmate.org/trunk/Bundles/Ruby.tmbundle@8313 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
  • Loading branch information...
commit 53ed3788023d1ceb8e6ff943965f080d22070293 1 parent 4a68c7b
@JEG2 JEG2 authored
Showing with 14 additions and 3 deletions.
  1. +14 −3 Commands/New Method.plist
View
17 Commands/New Method.plist
@@ -5,11 +5,22 @@
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
- <string>cat &lt;&lt;SNIPPET
-def ${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}\${1/.+/(/}\${1:args}\${1/.+/)/}
+ <string>#!/usr/bin/env ruby -wKU
+
+require "#{ENV['TM_SUPPORT_PATH']}/lib/exit_codes"
+require "#{ENV['TM_SUPPORT_PATH']}/lib/escape"
+
+method_name = ENV["TM_SELECTED_TEXT"] || ENV["TM_CURRENT_WORD"] or
+ TextMate.exit_show_tool_tip(
+ "Please type the new function's name or use the def⇥ snippet."
+ )
+
+print &lt;&lt;END_SNIPPET
+def #{e_sn method_name}\${1/.+/(/}\${1:args}\${1/.+/)/}
\$0
end
-SNIPPET</string>
+END_SNIPPET
+</string>
<key>fallbackInput</key>
<string>word</string>
<key>input</key>
Please sign in to comment.
Something went wrong with that request. Please try again.