finish
endif
-function! RemoveEmptySuperClass()
- if @z == "SuperClass"
- s/extends '<{}>';\n\n//e
- return ""
+function! RemoveUnchangedLine()
+ if match(getline('.'), "<{}>") >= 0
+ normal! dd
+ return ''
+ else
+ return @z
endif
-
- return @z
-endfun
-
-function! RemoveEmptyLine()
- s/^\s*<{}>\s*\n//e
- return @z
endfun
function! Snippet(abbr, str)
\"package ".ParameterizedModule().";",
\"use Moose;",
\"",
- \"extends '<{SuperClass:RemoveEmptySuperClass()}>';",
+ \"extends '<{SuperClass:RemoveUnchangedLine()}>;",
\"",
\"<{}>",
\"",
\"has <{attr}> => (",
\ "is => '<{rw}>',",
\ "isa => '<{Str}>',",
- \ "<{options:RemoveEmptyLine()}>",
+ \ "<{options:RemoveUnchangedLine()}>",
\");"])
call Snippet('hasl', [
\"has <{attr}> => (",
\ "is => '<{rw}>',",
\ "isa => '<{Str}>',",
\ "lazy_build => 1,",
- \ "<{options:RemoveEmptyLine()}>",
+ \ "<{options:RemoveUnchangedLine()}>",
\");",
\"",
\"sub _build_<{attr}> {",
call Snippet('sub', [
\"sub <{name}> {",
\ "my $self = shift;",
+ \ "my (<{arg:RemoveUnchangedLine()}>) = @_;",
\ "<{}>",
\"}"])
call Snippet('around', [