Ruby: Remove excessive whitespace
This commit is contained in:
parent
b7fb63cd15
commit
c46251515f
@ -5,34 +5,25 @@ snippet "^#!" "#!/usr/bin/env ruby" r
|
|||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
snippet "^# ?[uU][tT][fF]-?8" "# encoding: UTF-8" r
|
snippet "^# ?[uU][tT][fF]-?8" "# encoding: UTF-8" r
|
||||||
# encoding: UTF-8
|
# encoding: UTF-8
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet If "<command> if <expression>"
|
snippet If "<command> if <expression>"
|
||||||
${1:command} if ${0:expression}
|
${1:command} if ${0:expression}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet Unless "<command> unless <expression>"
|
snippet Unless "<command> unless <expression>"
|
||||||
${1:command} unless ${0:expression}
|
${1:command} unless ${0:expression}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet if "if <condition> ... end"
|
snippet if "if <condition> ... end"
|
||||||
if ${1:condition}
|
if ${1:condition}
|
||||||
${2:# TODO}
|
${2:# TODO}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet ife "if <condition> ... else ... end"
|
snippet ife "if <condition> ... else ... end"
|
||||||
if ${1:condition}
|
if ${1:condition}
|
||||||
${2:# TODO}
|
${2:# TODO}
|
||||||
@ -41,8 +32,6 @@ else
|
|||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet ifee "if <condition> ... elseif <condition> ... else ... end"
|
snippet ifee "if <condition> ... elseif <condition> ... else ... end"
|
||||||
if ${1:condition}
|
if ${1:condition}
|
||||||
${2:# TODO}
|
${2:# TODO}
|
||||||
@ -53,16 +42,12 @@ else
|
|||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet unless "unless <condition> ... end"
|
snippet unless "unless <condition> ... end"
|
||||||
unless ${1:condition}
|
unless ${1:condition}
|
||||||
${0:# TODO}
|
${0:# TODO}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet unlesse "unless <condition> ... else ... end"
|
snippet unlesse "unless <condition> ... else ... end"
|
||||||
unless ${1:condition}
|
unless ${1:condition}
|
||||||
${2:# TODO}
|
${2:# TODO}
|
||||||
@ -71,8 +56,6 @@ else
|
|||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet unlesee "unless <condition> ... elseif <condition> ... else ... end"
|
snippet unlesee "unless <condition> ... elseif <condition> ... else ... end"
|
||||||
unless ${1:condition}
|
unless ${1:condition}
|
||||||
${2:# TODO}
|
${2:# TODO}
|
||||||
@ -83,24 +66,18 @@ else
|
|||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "\b(de)?f" "def <name>..." r
|
snippet "\b(de)?f" "def <name>..." r
|
||||||
def ${1:function_name}${2:(${3:*args})}
|
def ${1:function_name}${2:(${3:*args})}
|
||||||
${0:# TODO}
|
${0:# TODO}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet defi "def initialize ..."
|
snippet defi "def initialize ..."
|
||||||
def initialize${1:(${2:*args})}
|
def initialize${1:(${2:*args})}
|
||||||
${0:# TODO}
|
${0:# TODO}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet defr "def <name> ... rescue ..."
|
snippet defr "def <name> ... rescue ..."
|
||||||
def ${1:function_name}${2:(${3:*args})}
|
def ${1:function_name}${2:(${3:*args})}
|
||||||
${4:# TODO}
|
${4:# TODO}
|
||||||
@ -109,163 +86,116 @@ rescue
|
|||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet For "(<from>..<to>).each { |<i>| <block> }"
|
snippet For "(<from>..<to>).each { |<i>| <block> }"
|
||||||
(${1:from}..${2:to}).each { |${3:i}| ${4:# TODO} }
|
(${1:from}..${2:to}).each { |${3:i}| ${4:# TODO} }
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet for "(<from>..<to>).each do |<i>| <block> end"
|
snippet for "(<from>..<to>).each do |<i>| <block> end"
|
||||||
(${1:from}..${2:to}).each do |${3:i}|
|
(${1:from}..${2:to}).each do |${3:i}|
|
||||||
${0:# TODO}
|
${0:# TODO}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.Merge!" ".merge!(<other_hash>) { |<key>,<oldval>,<newval>| <block> }" r
|
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} }
|
`!p snip.rv=match.group(1)`.merge!(${1:other_hash}) { |${2:key},${3:oldval},${4:newval}| ${5:block} }
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.merge!" ".merge!(<other_hash>) do |<key>,<oldval>,<newval>| <block> end" r
|
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}|
|
`!p snip.rv=match.group(1)`.merge!(${1:other_hash}) do |${2:key},${3:oldval},${4:newval}|
|
||||||
${0:block}
|
${0:block}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.Del(ete)?_?if" ".delete_if { |<key>,<value>| <block> }" r
|
snippet "(\S+)\.Del(ete)?_?if" ".delete_if { |<key>,<value>| <block> }" r
|
||||||
`!p snip.rv=match.group(1)`.delete_if { |${1:key},${2:value}| ${3:# TODO} }
|
`!p snip.rv=match.group(1)`.delete_if { |${1:key},${2:value}| ${3:# TODO} }
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.del(ete)?_?if" ".delete_if do |<key>,<value>| <block> end" r
|
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}|
|
`!p snip.rv=match.group(1)`.delete_if do |${1:key},${2:value}|
|
||||||
${0:# TODO}
|
${0:# TODO}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.Keep_?if" ".keep_if { |<key>,<value>| <block> }" r
|
snippet "(\S+)\.Keep_?if" ".keep_if { |<key>,<value>| <block> }" r
|
||||||
`!p snip.rv=match.group(1)`.keep_if { |${1:key},${2:value}| ${3:# TODO} }
|
`!p snip.rv=match.group(1)`.keep_if { |${1:key},${2:value}| ${3:# TODO} }
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.keep_?if" ".keep_if do <key>,<value>| <block> end" r
|
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}|
|
`!p snip.rv=match.group(1)`.keep_if do |${1:key},${2:value}|
|
||||||
${0:# TODO}
|
${0:# TODO}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.Reject" ".reject { |<key>,<value>| <block> }" r
|
snippet "(\S+)\.Reject" ".reject { |<key>,<value>| <block> }" r
|
||||||
`!p snip.rv=match.group(1)`.reject { |${1:key},${2:value}| ${3:# TODO} }
|
`!p snip.rv=match.group(1)`.reject { |${1:key},${2:value}| ${3:# TODO} }
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.reject" ".reject do <key>,<value>| <block> end" r
|
snippet "(\S+)\.reject" ".reject do <key>,<value>| <block> end" r
|
||||||
`!p snip.rv=match.group(1)`.reject do |${1:key},${2:value}|
|
`!p snip.rv=match.group(1)`.reject do |${1:key},${2:value}|
|
||||||
${0:# TODO}
|
${0:# TODO}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.Select" ".select { |<item>| <block>}" r
|
snippet "(\S+)\.Select" ".select { |<item>| <block>}" r
|
||||||
`!p snip.rv=match.group(1)`.select { |${1:item}| ${2:block} }
|
`!p snip.rv=match.group(1)`.select { |${1:item}| ${2:block} }
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.select" ".select do |<item>| <block> end" r
|
snippet "(\S+)\.select" ".select do |<item>| <block> end" r
|
||||||
`!p snip.rv=match.group(1)`.select do |${1:item}|
|
`!p snip.rv=match.group(1)`.select do |${1:item}|
|
||||||
${0:block}
|
${0:block}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.Sort" ".sort { |<a>,<b>| <block> }" r
|
snippet "(\S+)\.Sort" ".sort { |<a>,<b>| <block> }" r
|
||||||
`!p snip.rv=match.group(1)`.sort { |${1:a},${2:b}| ${3:# TODO} }
|
`!p snip.rv=match.group(1)`.sort { |${1:a},${2:b}| ${3:# TODO} }
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.sort" ".sort do |<a>,<b>| <block> end" r
|
snippet "(\S+)\.sort" ".sort do |<a>,<b>| <block> end" r
|
||||||
`!p snip.rv=match.group(1)`.sort do |${1:a},${2:b}|
|
`!p snip.rv=match.group(1)`.sort do |${1:a},${2:b}|
|
||||||
${0:# TODO}
|
${0:# TODO}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.Each_?k(ey)?" ".each_key { |<key>| <block> }" r
|
snippet "(\S+)\.Each_?k(ey)?" ".each_key { |<key>| <block> }" r
|
||||||
`!p snip.rv=match.group(1)`.each_key { |${1:key}| ${2:# TODO} }
|
`!p snip.rv=match.group(1)`.each_key { |${1:key}| ${2:# TODO} }
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.each_?k(ey)?" ".each_key do |key| <block> end" r
|
snippet "(\S+)\.each_?k(ey)?" ".each_key do |key| <block> end" r
|
||||||
`!p snip.rv=match.group(1)`.each_key do |${1:key}|
|
`!p snip.rv=match.group(1)`.each_key do |${1:key}|
|
||||||
${0:# TODO}
|
${0:# TODO}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.Each_?val(ue)?" ".each_value { |<value>| <block> }" r
|
snippet "(\S+)\.Each_?val(ue)?" ".each_value { |<value>| <block> }" r
|
||||||
`!p snip.rv=match.group(1)`.each_value { |${1:value}| ${2:# TODO} }
|
`!p snip.rv=match.group(1)`.each_value { |${1:value}| ${2:# TODO} }
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.each_?val(ue)?" ".each_value do |<value>| <block> end" r
|
snippet "(\S+)\.each_?val(ue)?" ".each_value do |<value>| <block> end" r
|
||||||
`!p snip.rv=match.group(1)`.each_value do |${1:value}|
|
`!p snip.rv=match.group(1)`.each_value do |${1:value}|
|
||||||
${0:# TODO}
|
${0:# TODO}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet Each "<elements>.each { |<element>| <block> }"
|
snippet Each "<elements>.each { |<element>| <block> }"
|
||||||
${1:elements}.each { |${2:${1/s$//}}| ${3:# TODO} }
|
${1:elements}.each { |${2:${1/s$//}}| ${3:# TODO} }
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet each "<elements>.each do |<element>| <block> end"
|
snippet each "<elements>.each do |<element>| <block> end"
|
||||||
${1:elements}.each do |${2:${1/s$//}}|
|
${1:elements}.each do |${2:${1/s$//}}|
|
||||||
${0:# TODO}
|
${0:# TODO}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "each_?s(lice)?" "<array>.each_slice(n) do |slice| <block> end" r
|
snippet "each_?s(lice)?" "<array>.each_slice(n) do |slice| <block> end" r
|
||||||
${1:elements}.each_slice(${2:2}) do |${3:slice}|
|
${1:elements}.each_slice(${2:2}) do |${3:slice}|
|
||||||
${0:# TODO}
|
${0:# TODO}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "Each_?s(lice)?" "<array>.each_slice(n) { |slice| <block> }" r
|
snippet "Each_?s(lice)?" "<array>.each_slice(n) { |slice| <block> }" r
|
||||||
${1:elements}.each_slice(${2:2}) { |${3:slice}| ${0:# TODO} }
|
${1:elements}.each_slice(${2:2}) { |${3:slice}| ${0:# TODO} }
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.Map" ".map { |<element>| <block> }" r
|
snippet "(\S+)\.Map" ".map { |<element>| <block> }" r
|
||||||
`!p snip.rv=match.group(1)`.map { |${1:`!p
|
`!p snip.rv=match.group(1)`.map { |${1:`!p
|
||||||
element_name = match.group(1).lstrip('$@')
|
element_name = match.group(1).lstrip('$@')
|
||||||
@ -278,8 +208,6 @@ except:
|
|||||||
`}| ${2:# TODO} }
|
`}| ${2:# TODO} }
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.map" ".map do |<element>| <block> end" r
|
snippet "(\S+)\.map" ".map do |<element>| <block> end" r
|
||||||
`!p snip.rv=match.group(1)`.map do |${1:`!p
|
`!p snip.rv=match.group(1)`.map do |${1:`!p
|
||||||
element_name = match.group(1).lstrip('$@')
|
element_name = match.group(1).lstrip('$@')
|
||||||
@ -294,8 +222,6 @@ except:
|
|||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.Rev(erse)?_?each" ".reverse_each { |<element>| <block> }" r
|
snippet "(\S+)\.Rev(erse)?_?each" ".reverse_each { |<element>| <block> }" r
|
||||||
`!p snip.rv=match.group(1)`.reverse_each { |${1:`!p
|
`!p snip.rv=match.group(1)`.reverse_each { |${1:`!p
|
||||||
element_name = match.group(1).lstrip('$@')
|
element_name = match.group(1).lstrip('$@')
|
||||||
@ -308,8 +234,6 @@ except:
|
|||||||
`}| ${2:# TODO} }
|
`}| ${2:# TODO} }
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.rev(erse)?_?each" ".reverse_each do |<element>| <block> end" r
|
snippet "(\S+)\.rev(erse)?_?each" ".reverse_each do |<element>| <block> end" r
|
||||||
`!p snip.rv=match.group(1)`.reverse_each do |${1:`!p
|
`!p snip.rv=match.group(1)`.reverse_each do |${1:`!p
|
||||||
element_name = match.group(1).lstrip('$@')
|
element_name = match.group(1).lstrip('$@')
|
||||||
@ -324,8 +248,6 @@ except:
|
|||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.Each" ".each { |<element>| <block> }" r
|
snippet "(\S+)\.Each" ".each { |<element>| <block> }" r
|
||||||
`!p snip.rv=match.group(1)`.each { |${1:`!p
|
`!p snip.rv=match.group(1)`.each { |${1:`!p
|
||||||
element_name = match.group(1).lstrip('$@')
|
element_name = match.group(1).lstrip('$@')
|
||||||
@ -338,8 +260,6 @@ except:
|
|||||||
`}| ${2:# TODO} }
|
`}| ${2:# TODO} }
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.each" ".each do |<element>| <block> end" r
|
snippet "(\S+)\.each" ".each do |<element>| <block> end" r
|
||||||
`!p snip.rv=match.group(1)`.each do |${1:`!p
|
`!p snip.rv=match.group(1)`.each do |${1:`!p
|
||||||
element_name = match.group(1).lstrip('$@')
|
element_name = match.group(1).lstrip('$@')
|
||||||
@ -354,9 +274,6 @@ except:
|
|||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.Each_?w(ith)?_?i(ndex)?" ".each_with_index { |<element>,<i>| <block> }" r
|
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
|
`!p snip.rv=match.group(1)`.each_with_index { |${1:`!p
|
||||||
element_name = match.group(1).lstrip('$@')
|
element_name = match.group(1).lstrip('$@')
|
||||||
@ -369,8 +286,6 @@ except:
|
|||||||
`},${2:i}| ${3:# TODO} }$0
|
`},${2:i}| ${3:# TODO} }$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.each_?w(ith)?_?i(ndex)?" ".each_with_index do |<element>,<i>| <block> end" r
|
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
|
`!p snip.rv=match.group(1)`.each_with_index do |${1:`!p
|
||||||
element_name = match.group(1).lstrip('$@')
|
element_name = match.group(1).lstrip('$@')
|
||||||
@ -385,114 +300,82 @@ except:
|
|||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.Each_?p(air)?" ".each_pair { |<key>,<value>| <block> }" r
|
snippet "(\S+)\.Each_?p(air)?" ".each_pair { |<key>,<value>| <block> }" r
|
||||||
`!p snip.rv=match.group(1)`.each_pair { |${1:key},${2:value}| ${3:# TODO} }
|
`!p snip.rv=match.group(1)`.each_pair { |${1:key},${2:value}| ${3:# TODO} }
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.each_?p(air)?" ".each_pair do |<key>,<value>| <block> end" r
|
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}|
|
`!p snip.rv=match.group(1)`.each_pair do |${1:key},${2:value}|
|
||||||
${0:# TODO}
|
${0:# TODO}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.sub" ".sub(<expression>) { <block> }" r
|
snippet "(\S+)\.sub" ".sub(<expression>) { <block> }" r
|
||||||
`!p snip.rv=match.group(1)`.sub(${1:expression}) { ${2:"replace_with"} }
|
`!p snip.rv=match.group(1)`.sub(${1:expression}) { ${2:"replace_with"} }
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.gsub" ".gsub(<expression>) { <block> }" r
|
snippet "(\S+)\.gsub" ".gsub(<expression>) { <block> }" r
|
||||||
`!p snip.rv=match.group(1)`.gsub(${1:expression}) { ${2:"replace_with"} }
|
`!p snip.rv=match.group(1)`.gsub(${1:expression}) { ${2:"replace_with"} }
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.index" ".index { |item| <block> }" r
|
snippet "(\S+)\.index" ".index { |item| <block> }" r
|
||||||
`!p snip.rv=match.group(1)`.index { |${1:item}| ${2:block} }
|
`!p snip.rv=match.group(1)`.index { |${1:item}| ${2:block} }
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "(\S+)\.Index" ".index do |item| ... end" r
|
snippet "(\S+)\.Index" ".index do |item| ... end" r
|
||||||
`!p snip.rv=match.group(1)`.index do |${1:item}|
|
`!p snip.rv=match.group(1)`.index do |${1:item}|
|
||||||
${0:block}
|
${0:block}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet do "do |<key>| ... end" i
|
snippet do "do |<key>| ... end" i
|
||||||
do |${1:args}|
|
do |${1:args}|
|
||||||
$0
|
$0
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet Do "do ... end" i
|
snippet Do "do ... end" i
|
||||||
do
|
do
|
||||||
$0
|
$0
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
snippet until "until <expression> ... end"
|
snippet until "until <expression> ... end"
|
||||||
until ${1:expression}
|
until ${1:expression}
|
||||||
${0:# TODO}
|
${0:# TODO}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet Until "begin ... end until <expression>"
|
snippet Until "begin ... end until <expression>"
|
||||||
begin
|
begin
|
||||||
${0:# TODO}
|
${0:# TODO}
|
||||||
end until ${1:expression}
|
end until ${1:expression}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet while "while <expression> ... end"
|
snippet while "while <expression> ... end"
|
||||||
while ${1:expression}
|
while ${1:expression}
|
||||||
${0:# TODO}
|
${0:# TODO}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet While "begin ... end while <expression>"
|
snippet While "begin ... end while <expression>"
|
||||||
begin
|
begin
|
||||||
${0:# TODO}
|
${0:# TODO}
|
||||||
end while ${1:expression}
|
end while ${1:expression}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "\b(r|attr)" "attr_reader :<attr_names>" r
|
snippet "\b(r|attr)" "attr_reader :<attr_names>" r
|
||||||
attr_reader :${0:attr_names}
|
attr_reader :${0:attr_names}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "\b(w|attr)" "attr_writer :<attr_names>" r
|
snippet "\b(w|attr)" "attr_writer :<attr_names>" r
|
||||||
attr_writer :${0:attr_names}
|
attr_writer :${0:attr_names}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "\b(rw|attr)" "attr_accessor :<attr_names>" r
|
snippet "\b(rw|attr)" "attr_accessor :<attr_names>" r
|
||||||
attr_accessor :${0:attr_names}
|
attr_accessor :${0:attr_names}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet begin "begin ... rescue ... end"
|
snippet begin "begin ... rescue ... end"
|
||||||
begin
|
begin
|
||||||
${1:# TODO}
|
${1:# TODO}
|
||||||
@ -501,8 +384,6 @@ rescue
|
|||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet begin "begin ... rescue ... else ... ensure ... end"
|
snippet begin "begin ... rescue ... else ... ensure ... end"
|
||||||
begin
|
begin
|
||||||
${1:# Raise exception}
|
${1:# Raise exception}
|
||||||
@ -517,8 +398,6 @@ ensure
|
|||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet rescue
|
snippet rescue
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts e.message
|
puts e.message
|
||||||
@ -526,8 +405,6 @@ rescue Exception => e
|
|||||||
${0:# Rescue}
|
${0:# Rescue}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet "\b(case|sw(itch)?)" "case <variable> when <expression> ... end" r
|
snippet "\b(case|sw(itch)?)" "case <variable> when <expression> ... end" r
|
||||||
case ${1:variable}
|
case ${1:variable}
|
||||||
when ${2:expression}
|
when ${2:expression}
|
||||||
@ -535,14 +412,10 @@ $0
|
|||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet alias "alias :<new_name> :<old_name>"
|
snippet alias "alias :<new_name> :<old_name>"
|
||||||
alias :${1:new_name} :${2:old_name}
|
alias :${1:new_name} :${2:old_name}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet class "class <class_name> def initialize ... end end"
|
snippet class "class <class_name> def initialize ... end end"
|
||||||
class ${1:class_name}
|
class ${1:class_name}
|
||||||
def initialize(${2:*args})
|
def initialize(${2:*args})
|
||||||
@ -551,16 +424,12 @@ class ${1:class_name}
|
|||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet module "module"
|
snippet module "module"
|
||||||
module ${1:module_name}
|
module ${1:module_name}
|
||||||
$0
|
$0
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
snippet ###
|
snippet ###
|
||||||
=begin
|
=begin
|
||||||
$0
|
$0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user