Upper camelcase for class and module name in ruby

This commit is contained in:
Kentaro Imai 2011-11-27 00:19:33 +09:00
parent 09f0acf92a
commit e622c24d78

View File

@ -69,11 +69,11 @@ snippet until
${2} ${2}
end end
snippet cla class .. end snippet cla class .. end
class ${1:`substitute(Filename(), '^.', '\u&', '')`} class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
${2} ${2}
end end
snippet cla class .. initialize .. end snippet cla class .. initialize .. end
class ${1:`substitute(Filename(), '^.', '\u&', '')`} class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
def initialize(${2:args}) def initialize(${2:args})
${3} ${3}
end end
@ -81,7 +81,7 @@ snippet cla class .. initialize .. end
end end
snippet cla class .. < ParentClass .. initialize .. end snippet cla class .. < ParentClass .. initialize .. end
class ${1:`substitute(Filename(), '^.', '\u&', '')`} < ${2:ParentClass} class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < ${2:ParentClass}
def initialize(${3:args}) def initialize(${3:args})
${4} ${4}
end end
@ -89,7 +89,7 @@ snippet cla class .. < ParentClass .. initialize .. end
end end
snippet cla ClassName = Struct .. do .. end snippet cla ClassName = Struct .. do .. end
${1:`substitute(Filename(), '^.', '\u&', '')`} = Struct.new(:${2:attr_names}) do ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} = Struct.new(:${2:attr_names}) do
def ${3:method_name} def ${3:method_name}
${4} ${4}
end end
@ -105,7 +105,7 @@ snippet cla class << self .. end
end end
# class .. < DelegateClass .. initialize .. end # class .. < DelegateClass .. initialize .. end
snippet cla- snippet cla-
class ${1:`substitute(Filename(), '^.', '\u&', '')`} < DelegateClass(${2:ParentClass}) class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < DelegateClass(${2:ParentClass})
def initialize(${3:args}) def initialize(${3:args})
super(${4:del_obj}) super(${4:del_obj})
@ -115,17 +115,17 @@ snippet cla-
end end
snippet mod module .. end snippet mod module .. end
module ${1:`substitute(Filename(), '^.', '\u&', '')`} module ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
${2} ${2}
end end
snippet mod module .. module_function .. end snippet mod module .. module_function .. end
module ${1:`substitute(Filename(), '^.', '\u&', '')`} module ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
module_function module_function
${2} ${2}
end end
snippet mod module .. ClassMethods .. end snippet mod module .. ClassMethods .. end
module ${1:`substitute(Filename(), '^.', '\u&', '')`} module ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
module ClassMethods module ClassMethods
${2} ${2}
end end