2012-08-17 03:41:25 +00:00
|
|
|
snippet "^#!" "#!/usr/bin/env ruby" r
|
|
|
|
#!/usr/bin/env ruby
|
|
|
|
$0
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
snippet "^# ?[uU][tT][fF]-?8" "# encoding: UTF-8" r
|
|
|
|
# encoding: UTF-8
|
|
|
|
$0
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet If "<command> if <expression>"
|
|
|
|
${1:command} if ${0:expression}
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet Unless "<command> unless <expression>"
|
|
|
|
${1:command} unless ${0:expression}
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet if "if <condition> ... end"
|
|
|
|
if ${1:condition}
|
2013-07-17 23:06:05 +00:00
|
|
|
${2}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet ife "if <condition> ... else ... end"
|
|
|
|
if ${1:condition}
|
2013-07-17 23:06:05 +00:00
|
|
|
${2}
|
2012-08-17 03:41:25 +00:00
|
|
|
else
|
2013-07-17 23:06:05 +00:00
|
|
|
${3}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet ifee "if <condition> ... elseif <condition> ... else ... end"
|
|
|
|
if ${1:condition}
|
2013-07-17 23:06:05 +00:00
|
|
|
${2}
|
2012-08-17 03:41:25 +00:00
|
|
|
elsif ${3:condition}
|
2013-07-17 23:06:05 +00:00
|
|
|
${4}
|
2012-08-17 03:41:25 +00:00
|
|
|
else
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet unless "unless <condition> ... end"
|
|
|
|
unless ${1:condition}
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet unlesse "unless <condition> ... else ... end"
|
|
|
|
unless ${1:condition}
|
2013-07-17 23:06:05 +00:00
|
|
|
${2}
|
2012-08-17 03:41:25 +00:00
|
|
|
else
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet unlesee "unless <condition> ... elseif <condition> ... else ... end"
|
|
|
|
unless ${1:condition}
|
2013-07-17 23:06:05 +00:00
|
|
|
${2}
|
2012-08-17 03:41:25 +00:00
|
|
|
elsif ${3:condition}
|
2013-07-17 23:06:05 +00:00
|
|
|
${4}
|
2012-08-17 03:41:25 +00:00
|
|
|
else
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "\b(de)?f" "def <name>..." r
|
|
|
|
def ${1:function_name}${2: ${3:*args}}
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet defi "def initialize ..."
|
|
|
|
def initialize${1: ${2:*args}}
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet defr "def <name> ... rescue ..."
|
|
|
|
def ${1:function_name}${2: ${3:*args}}
|
2013-07-17 23:06:05 +00:00
|
|
|
${4}
|
2012-08-17 03:41:25 +00:00
|
|
|
rescue
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet For "(<from>..<to>).each { |<i>| <block> }"
|
2013-07-17 23:06:05 +00:00
|
|
|
(${1:from}..${2:to}).each { |${3:i}| ${4} }
|
2012-08-17 03:41:25 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet for "(<from>..<to>).each do |<i>| <block> end"
|
|
|
|
(${1:from}..${2:to}).each do |${3:i}|
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.Merge!" ".merge!(<other_hash>) { |<key>,<oldval>,<newval>| <block> }" r
|
|
|
|
`!p snip.rv=match.group(1)`.merge!(${1:other_hash}) { |${2:key},${3:oldval},${4:newval}| ${5:block} }
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.merge!" ".merge!(<other_hash>) do |<key>,<oldval>,<newval>| <block> end" r
|
|
|
|
`!p snip.rv=match.group(1)`.merge!(${1:other_hash}) do |${2:key},${3:oldval},${4:newval}|
|
|
|
|
${0:block}
|
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.Del(ete)?_?if" ".delete_if { |<key>,<value>| <block> }" r
|
2013-07-17 23:06:05 +00:00
|
|
|
`!p snip.rv=match.group(1)`.delete_if { |${1:key},${2:value}| ${3} }
|
2012-08-17 03:41:25 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.del(ete)?_?if" ".delete_if do |<key>,<value>| <block> end" r
|
|
|
|
`!p snip.rv=match.group(1)`.delete_if do |${1:key},${2:value}|
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.Keep_?if" ".keep_if { |<key>,<value>| <block> }" r
|
2013-07-17 23:06:05 +00:00
|
|
|
`!p snip.rv=match.group(1)`.keep_if { |${1:key},${2:value}| ${3} }
|
2012-08-17 03:41:25 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.keep_?if" ".keep_if do <key>,<value>| <block> end" r
|
|
|
|
`!p snip.rv=match.group(1)`.keep_if do |${1:key},${2:value}|
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.Reject" ".reject { |<key>,<value>| <block> }" r
|
2013-07-17 23:06:05 +00:00
|
|
|
`!p snip.rv=match.group(1)`.reject { |${1:key},${2:value}| ${3} }
|
2012-08-17 03:41:25 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.reject" ".reject do <key>,<value>| <block> end" r
|
|
|
|
`!p snip.rv=match.group(1)`.reject do |${1:key},${2:value}|
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.Select" ".select { |<item>| <block>}" r
|
|
|
|
`!p snip.rv=match.group(1)`.select { |${1:item}| ${2:block} }
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.select" ".select do |<item>| <block> end" r
|
|
|
|
`!p snip.rv=match.group(1)`.select do |${1:item}|
|
|
|
|
${0:block}
|
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.Sort" ".sort { |<a>,<b>| <block> }" r
|
2013-07-17 23:06:05 +00:00
|
|
|
`!p snip.rv=match.group(1)`.sort { |${1:a},${2:b}| ${3} }
|
2012-08-17 03:41:25 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.sort" ".sort do |<a>,<b>| <block> end" r
|
|
|
|
`!p snip.rv=match.group(1)`.sort do |${1:a},${2:b}|
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.Each_?k(ey)?" ".each_key { |<key>| <block> }" r
|
2013-07-17 23:06:05 +00:00
|
|
|
`!p snip.rv=match.group(1)`.each_key { |${1:key}| ${2} }
|
2012-08-17 03:41:25 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.each_?k(ey)?" ".each_key do |key| <block> end" r
|
|
|
|
`!p snip.rv=match.group(1)`.each_key do |${1:key}|
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.Each_?val(ue)?" ".each_value { |<value>| <block> }" r
|
2013-07-17 23:06:05 +00:00
|
|
|
`!p snip.rv=match.group(1)`.each_value { |${1:value}| ${2} }
|
2012-08-17 03:41:25 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.each_?val(ue)?" ".each_value do |<value>| <block> end" r
|
|
|
|
`!p snip.rv=match.group(1)`.each_value do |${1:value}|
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet Each "<elements>.each { |<element>| <block> }"
|
2013-07-17 23:06:05 +00:00
|
|
|
${1:elements}.each { |${2:${1/s$//}}| ${3} }
|
2012-08-17 03:41:25 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet each "<elements>.each do |<element>| <block> end"
|
|
|
|
${1:elements}.each do |${2:${1/s$//}}|
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet each_?s(lice)? "<array>.each_slice(n) do |slice| <block> end"
|
|
|
|
each_slice(${1:2}) do |${2:slice}|
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet Each_?s(lice)? "<array>.each_slice(n) { |slice| <block> }"
|
2013-07-17 23:06:05 +00:00
|
|
|
each_slice(${1:2}) { |${2:slice}| ${3} }
|
2012-08-17 03:41:25 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.Map" ".map { |<element>| <block> }" r
|
|
|
|
`!p snip.rv=match.group(1)`.map { |${1:`!p
|
|
|
|
element_name = match.group(1).lstrip('$@')
|
|
|
|
ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name)
|
|
|
|
try:
|
|
|
|
wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1))
|
|
|
|
snip.rv = wmatch.group(1).lower()
|
|
|
|
except:
|
|
|
|
snip.rv = 'element'
|
2013-07-17 23:06:05 +00:00
|
|
|
`}| ${2} }
|
2012-08-17 03:41:25 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.map" ".map do |<element>| <block> end" r
|
|
|
|
`!p snip.rv=match.group(1)`.map do |${1:`!p
|
|
|
|
element_name = match.group(1).lstrip('$@')
|
|
|
|
ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name)
|
|
|
|
try:
|
|
|
|
wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1))
|
|
|
|
snip.rv = wmatch.group(1).lower()
|
|
|
|
except:
|
|
|
|
snip.rv = 'element'
|
|
|
|
`}|
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.Rev(erse)?_?each" ".reverse_each { |<element>| <block> }" r
|
|
|
|
`!p snip.rv=match.group(1)`.reverse_each { |${1:`!p
|
|
|
|
element_name = match.group(1).lstrip('$@')
|
|
|
|
ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name)
|
|
|
|
try:
|
|
|
|
wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1))
|
|
|
|
snip.rv = wmatch.group(1).lower()
|
|
|
|
except:
|
|
|
|
snip.rv = 'element'
|
2013-07-17 23:06:05 +00:00
|
|
|
`}| ${2} }
|
2012-08-17 03:41:25 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.rev(erse)?_?each" ".reverse_each do |<element>| <block> end" r
|
|
|
|
`!p snip.rv=match.group(1)`.reverse_each do |${1:`!p
|
|
|
|
element_name = match.group(1).lstrip('$@')
|
|
|
|
ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name)
|
|
|
|
try:
|
|
|
|
wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1))
|
|
|
|
snip.rv = wmatch.group(1).lower()
|
|
|
|
except:
|
|
|
|
snip.rv = 'element'
|
|
|
|
`}|
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.Each" ".each { |<element>| <block> }" r
|
|
|
|
`!p snip.rv=match.group(1)`.each { |${1:`!p
|
|
|
|
element_name = match.group(1).lstrip('$@')
|
|
|
|
ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name)
|
|
|
|
try:
|
|
|
|
wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1))
|
|
|
|
snip.rv = wmatch.group(1).lower()
|
|
|
|
except:
|
|
|
|
snip.rv = 'element'
|
2013-07-17 23:06:05 +00:00
|
|
|
`}| ${2} }
|
2012-08-17 03:41:25 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.each" ".each do |<element>| <block> end" r
|
|
|
|
`!p snip.rv=match.group(1)`.each do |${1:`!p
|
|
|
|
element_name = match.group(1).lstrip('$@')
|
|
|
|
ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name)
|
|
|
|
try:
|
|
|
|
wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1))
|
|
|
|
snip.rv = wmatch.group(1).lower()
|
|
|
|
except:
|
|
|
|
snip.rv = 'element'
|
|
|
|
`}|
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.Each_w(ith)?_?i(ndex)?" ".each_with_index { |<element>,<i>| <block> }" r
|
|
|
|
`!p snip.rv=match.group(1)`.each_with_index { |${1:`!p
|
|
|
|
element_name = match.group(1).lstrip('$@')
|
|
|
|
ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name)
|
|
|
|
try:
|
|
|
|
wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1))
|
|
|
|
snip.rv = wmatch.group(1).lower()
|
|
|
|
except:
|
|
|
|
snip.rv = 'element'
|
2013-07-17 23:06:05 +00:00
|
|
|
`},${2:i}| ${3} }$0
|
2012-08-17 03:41:25 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.each_?w(ith)?_?i(ndex)?" ".each_with_index do |<element>,<i>| <block> end" r
|
|
|
|
`!p snip.rv=match.group(1)`.each_with_index do |${1:`!p
|
|
|
|
element_name = match.group(1).lstrip('$@')
|
|
|
|
ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name)
|
|
|
|
try:
|
|
|
|
wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1))
|
|
|
|
snip.rv = wmatch.group(1).lower()
|
|
|
|
except:
|
|
|
|
snip.rv = 'element'
|
|
|
|
`},${2:i}|
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.Each_?p(air)?" ".each_pair { |<key>,<value>| <block> }" r
|
2013-07-17 23:06:05 +00:00
|
|
|
`!p snip.rv=match.group(1)`.each_pair { |${1:key},${2:value}| ${3} }
|
2012-08-17 03:41:25 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.each_?p(air)?" ".each_pair do |<key>,<value>| <block> end" r
|
|
|
|
`!p snip.rv=match.group(1)`.each_pair do |${1:key},${2:value}|
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.sub" ".sub(<expression>) { <block> }" r
|
|
|
|
`!p snip.rv=match.group(1)`.sub(${1:expression}) { ${2:"replace_with"} }
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.gsub" ".gsub(<expression>) { <block> }" r
|
|
|
|
`!p snip.rv=match.group(1)`.gsub(${1:expression}) { ${2:"replace_with"} }
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.index" ".index { |item| <block> }" r
|
|
|
|
`!p snip.rv=match.group(1)`.index { |${1:item}| ${2:block} }
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "(\S+)\.Index" ".index do |item| ... end" r
|
|
|
|
`!p snip.rv=match.group(1)`.index do |${1:item}|
|
|
|
|
${0:block}
|
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
2013-07-17 23:06:05 +00:00
|
|
|
# comments about do and dov see snippets/ruby.snippets
|
|
|
|
snippet do "do ... end" i
|
|
|
|
do
|
2012-08-17 03:41:25 +00:00
|
|
|
$0
|
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
2013-07-17 23:06:05 +00:00
|
|
|
snippet dov "do |<key>| ... end" i
|
2013-11-16 19:45:48 +00:00
|
|
|
do |${1:v}|
|
|
|
|
$2
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
2013-07-17 23:06:05 +00:00
|
|
|
|
2012-08-17 03:41:25 +00:00
|
|
|
snippet until "until <expression> ... end"
|
|
|
|
until ${1:expression}
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet Until "begin ... end until <expression>"
|
|
|
|
begin
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end until ${1:expression}
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-16 19:45:48 +00:00
|
|
|
snippet wh "while <expression> ... end"
|
2012-08-17 03:41:25 +00:00
|
|
|
while ${1:expression}
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet While "begin ... end while <expression>"
|
|
|
|
begin
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end while ${1:expression}
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "\b(r|attr)" "attr_reader :<attr_names>" r
|
|
|
|
attr_reader :${0:attr_names}
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "\b(w|attr)" "attr_writer :<attr_names>" r
|
|
|
|
attr_writer :${0:attr_names}
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "\b(rw|attr)" "attr_accessor :<attr_names>" r
|
|
|
|
attr_accessor :${0:attr_names}
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet begin "begin ... rescue ... end"
|
|
|
|
begin
|
2013-07-17 23:06:05 +00:00
|
|
|
${1}
|
2012-08-17 03:41:25 +00:00
|
|
|
rescue
|
2013-07-17 23:06:05 +00:00
|
|
|
${0}
|
2012-08-17 03:41:25 +00:00
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet begin "begin ... rescue ... else ... ensure ... end"
|
|
|
|
begin
|
|
|
|
${1:# Raise exception}
|
|
|
|
rescue Exception => e
|
|
|
|
puts e.message
|
|
|
|
puts e.backtrace.inspect
|
|
|
|
${2:# Rescue}
|
|
|
|
else
|
|
|
|
${3:# other exception}
|
|
|
|
ensure
|
|
|
|
${0:# always excute}
|
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet rescue
|
|
|
|
rescue Exception => e
|
|
|
|
puts e.message
|
|
|
|
puts e.backtrace.inspect
|
|
|
|
${0:# Rescue}
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet "\b(case|sw(itch)?)" "case <variable> when <expression> ... end" r
|
|
|
|
case ${1:variable}
|
|
|
|
when ${2:expression}
|
|
|
|
$0
|
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet alias "alias :<new_name> :<old_name>"
|
|
|
|
alias :${1:new_name} :${2:old_name}
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet class "class <class_name> def initialize ... end end"
|
|
|
|
class ${1:class_name}
|
|
|
|
def initialize ${2:*args}
|
|
|
|
$0
|
|
|
|
end
|
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet module "module"
|
|
|
|
module ${1:module_name}
|
|
|
|
$0
|
|
|
|
end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snippet ###
|
|
|
|
=begin
|
|
|
|
$0
|
|
|
|
=end
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
# vim: set ts=2 sw=2 expandtab:
|