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}
end
snippet cla class .. end
class ${1:`substitute(Filename(), '^.', '\u&', '')`}
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
${2}
end
snippet cla class .. initialize .. end
class ${1:`substitute(Filename(), '^.', '\u&', '')`}
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
def initialize(${2:args})
${3}
end
@ -81,7 +81,7 @@ snippet cla class .. initialize .. end
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})
${4}
end
@ -89,7 +89,7 @@ snippet cla class .. < ParentClass .. initialize .. end
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}
${4}
end
@ -105,7 +105,7 @@ snippet cla class << self .. end
end
# class .. < DelegateClass .. initialize .. end
snippet cla-
class ${1:`substitute(Filename(), '^.', '\u&', '')`} < DelegateClass(${2:ParentClass})
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < DelegateClass(${2:ParentClass})
def initialize(${3:args})
super(${4:del_obj})
@ -115,17 +115,17 @@ snippet cla-
end
snippet mod module .. end
module ${1:`substitute(Filename(), '^.', '\u&', '')`}
module ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
${2}
end
snippet mod module .. module_function .. end
module ${1:`substitute(Filename(), '^.', '\u&', '')`}
module ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
module_function
${2}
end
snippet mod module .. ClassMethods .. end
module ${1:`substitute(Filename(), '^.', '\u&', '')`}
module ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
module ClassMethods
${2}
end