#!/usr/bin/env ruby -wKU
requireENV['TM_SUPPORT_PATH']+'/lib/ui.rb'requireENV['TM_SUPPORT_PATH']+'/lib/escape.rb'
new_method_name =TextMate::UI.request_string(:title=>'New Method Name',:prompt=>'Enter the name for your new method:',:default=>'charlie')
contents =DATA.read
placement = contents.scan(/\bdef \w+/).sort.find{|m|"def #{new_method_name}"< m};if contents =~/^([\t]*)(#{Regexp.escape(placement)})/STDOUT<< e_sn($`)STDOUT<<"#$1def #{new_method_name}\n#$1 $0\n#$1end\n\n#$1#$2"STDOUT<< e_sn($')end__END__
class Foo
def allan
puts $foo
end
def benny
end
def detron
end
end