2012-02-02 04:33:35 +00:00
|
|
|
snippet if
|
2012-10-28 09:49:19 +00:00
|
|
|
abbr if ... end
|
2012-10-30 08:53:14 +00:00
|
|
|
if ${1:#:condition}
|
|
|
|
${2:TARGET}
|
2012-02-02 04:33:35 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
snippet def
|
2012-10-28 09:49:19 +00:00
|
|
|
abbr def ... end
|
2012-10-30 08:53:14 +00:00
|
|
|
def ${1:#:method_name}
|
|
|
|
${2:TARGET}
|
2012-02-02 04:33:35 +00:00
|
|
|
end
|
|
|
|
|
2012-10-28 05:25:52 +00:00
|
|
|
snippet defrescue
|
|
|
|
alias defr
|
|
|
|
abbr def ... rescue ... end
|
2012-10-30 08:53:14 +00:00
|
|
|
def ${1:#:method_name}
|
|
|
|
${2:TARGET}
|
|
|
|
rescue ${3:#:StandardError} => ${4:error}
|
2012-10-28 05:25:52 +00:00
|
|
|
${5}
|
|
|
|
end
|
|
|
|
|
2012-02-02 04:33:35 +00:00
|
|
|
snippet do
|
2012-10-28 05:25:52 +00:00
|
|
|
abbr do ... end
|
2012-02-02 04:33:35 +00:00
|
|
|
do
|
2012-10-30 08:53:14 +00:00
|
|
|
${1:TARGET}
|
2012-02-02 04:33:35 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
snippet dovar
|
2012-10-28 09:49:19 +00:00
|
|
|
abbr do |var| ... end
|
2012-10-30 08:53:14 +00:00
|
|
|
do |${1:#:var}|
|
|
|
|
${2:TARGET}
|
2012-02-02 04:33:35 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
snippet block
|
2012-10-28 09:49:19 +00:00
|
|
|
abbr { ... }
|
2012-02-02 04:33:35 +00:00
|
|
|
{
|
2012-10-30 08:53:14 +00:00
|
|
|
${1:TARGET}
|
2012-02-02 04:33:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
snippet blockvar
|
2012-10-28 09:49:19 +00:00
|
|
|
abbr {|var| ... }
|
2012-10-30 08:53:14 +00:00
|
|
|
{|${1:#:var}|
|
|
|
|
${2:TARGET}
|
2012-02-02 04:33:35 +00:00
|
|
|
}
|
|
|
|
|
2012-09-23 05:55:13 +00:00
|
|
|
snippet fileopen
|
2012-10-28 09:49:19 +00:00
|
|
|
abbr File.open(filename) do ... end
|
2012-10-30 08:53:14 +00:00
|
|
|
File.open(${1:#:filename}, '${2:#:mode}') do |${3:io}|
|
|
|
|
${0:TARGET}
|
2012-09-23 05:55:13 +00:00
|
|
|
end
|
|
|
|
|
2012-02-02 04:33:35 +00:00
|
|
|
snippet edn
|
|
|
|
abbr => end?
|
|
|
|
end
|
|
|
|
|
|
|
|
snippet urlencode
|
|
|
|
# coding: utf-8
|
|
|
|
require 'erb'
|
|
|
|
puts ERB::Util.url_encode '${1}'
|
2012-10-28 09:49:19 +00:00
|
|
|
|
2013-03-24 08:30:27 +00:00
|
|
|
snippet encoding
|
|
|
|
alias enc
|
|
|
|
# coding: utf-8
|
|
|
|
${0}
|
|
|
|
|
|
|
|
snippet each
|
|
|
|
options word
|
|
|
|
each { |${1:#:variable}| ${2} }
|
|
|
|
|
|
|
|
snippet each_do
|
|
|
|
options word
|
|
|
|
each do |${1:#:variable}|
|
|
|
|
${2}
|
|
|
|
end
|
|
|
|
|
|
|
|
snippet each_byte
|
|
|
|
options word
|
2013-04-02 03:13:15 +00:00
|
|
|
each_byte {|${1:#:variable}| ${2} }
|
2013-03-24 08:30:27 +00:00
|
|
|
|
|
|
|
snippet each_char
|
|
|
|
options word
|
2013-04-02 03:13:15 +00:00
|
|
|
each_char {|${1:#:variable}| ${2} }
|
2013-03-24 08:30:27 +00:00
|
|
|
|
|
|
|
snippet each_index
|
|
|
|
options word
|
2013-04-02 03:13:15 +00:00
|
|
|
each_index {|${1:#:variable}| ${2} }
|
2013-03-24 08:30:27 +00:00
|
|
|
|
|
|
|
snippet each_key
|
|
|
|
options word
|
2013-04-02 03:13:15 +00:00
|
|
|
each_key {|${1:#:variable}| ${2} }
|
2013-03-24 08:30:27 +00:00
|
|
|
|
|
|
|
snippet each_line
|
|
|
|
options word
|
2013-04-02 03:13:15 +00:00
|
|
|
each_line {|${1:#:variable}| ${2} }
|
2013-03-24 08:30:27 +00:00
|
|
|
|
|
|
|
snippet each_with_index
|
|
|
|
options word
|
2013-04-02 03:13:15 +00:00
|
|
|
each_with_index {|${1:#:variable}| ${2} }
|
2013-03-24 08:30:27 +00:00
|
|
|
|
|
|
|
snippet map
|
|
|
|
options word
|
2013-04-02 03:13:15 +00:00
|
|
|
map {|${1:#:variable}| ${2} }
|
2013-03-24 08:30:27 +00:00
|
|
|
|
|
|
|
snippet sort
|
|
|
|
options word
|
2013-04-02 03:13:15 +00:00
|
|
|
sort {|${1:#:variable}| ${2} }
|
2013-03-24 08:30:27 +00:00
|
|
|
|
|
|
|
snippet sort_by
|
|
|
|
options word
|
2013-04-02 03:13:15 +00:00
|
|
|
sort_by {|${1:#:variable}| ${2} }
|
2013-03-24 08:30:27 +00:00
|
|
|
|
2013-04-02 03:13:15 +00:00
|
|
|
snippet lambda
|
2013-03-24 08:30:27 +00:00
|
|
|
options word
|
2013-04-02 03:13:15 +00:00
|
|
|
lambda {|${1:#:args}| ${2} }
|
2013-03-24 08:30:27 +00:00
|
|
|
|
2013-04-02 03:13:15 +00:00
|
|
|
snippet main
|
|
|
|
options head
|
2013-04-02 08:51:12 +00:00
|
|
|
if __FILE__ == \$0
|
2013-06-19 00:11:45 +00:00
|
|
|
${0:TARGET}
|
2013-04-02 03:13:15 +00:00
|
|
|
end
|
2013-06-19 00:11:45 +00:00
|
|
|
|
|
|
|
# This idiom is only for legacy ruby such as 1.9.3
|
|
|
|
snippet filedir-legacy-compatibility
|
|
|
|
alias __dir__
|
|
|
|
abbr File.dirname(...)
|
|
|
|
File.dirname(File.expand_path(__FILE__))
|
|
|
|
|
|
|
|
snippet glob
|
|
|
|
options head
|
|
|
|
Dir.glob(${1:'**/*'}) do |fname|
|
|
|
|
${0:TARGET}
|
|
|
|
end
|