Ruby: Remove some duplication

This commit is contained in:
Louis Pilfold 2015-05-05 16:57:16 +01:00
parent 6ff32d353e
commit 1327c1ba54
2 changed files with 3 additions and 27 deletions

View File

@ -302,18 +302,6 @@ begin
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
$1

View File

@ -121,23 +121,17 @@ snippet cla class .. initialize .. end
${0}
end
end
snippet cla class .. < ParentClass .. initialize .. end
snippet cla< class .. < ParentClass .. initialize .. end
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < ${2:ParentClass}
def initialize(${3:args})
${0}
end
end
snippet cla ClassName = Struct .. do .. end
${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} = Struct.new(:${2:attr_names}) do
def ${3:method_name}
${0}
end
end
snippet cla class BlankSlate .. initialize .. end
snippet blankslate class BlankSlate .. initialize .. end
class ${0:BlankSlate}
instance_methods.each { |meth| undef_method(meth) unless meth =~ /\A__/ }
end
snippet cla class << self .. end
snippet claself class << self .. end
class << ${1:self}
${0}
end
@ -152,12 +146,6 @@ snippet cla-
end
snippet mod module .. end
module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
${0}
end
snippet mod module .. module_function .. end
module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
module_function
${0}
end
snippet mod module .. ClassMethods .. end