From: Shawn M Moore Date: Mon, 4 May 2009 17:46:44 +0000 (-0400) Subject: Give class an optional "extends" X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9a5242eb014757b02b39ac072d46c02ad585b4c0;p=gitmo%2Fmoose-dev-utils.git Give class an optional "extends" --- diff --git a/vim/moose_snippets.vim b/vim/moose_snippets.vim index 541f05b..f08a714 100644 --- a/vim/moose_snippets.vim +++ b/vim/moose_snippets.vim @@ -9,7 +9,12 @@ let st = g:snip_start_tag let et = g:snip_end_tag let cd = g:snip_elem_delim -exec "Snippet class package ".st."ClassName".et.";use Moose;extends '".st."SuperClass".et."';".st.et."__PACKAGE__->meta->make_immutable;no Moose;1;" +function! RemoveEmptySuperClass() + s/^extends '<{}>';\n//e + return @z +endfun + +exec "Snippet class package ".st."ClassName".et.";use Moose;extends '".st."SuperClass:RemoveEmptySuperClass()".et."';".st.et."__PACKAGE__->meta->make_immutable;no Moose;1;" exec "Snippet has has ".st."attr".et." => (is => 'rw',isa => 'Str',".st.et.");" exec "Snippet hasl has ".st."attr".et." => (is => 'rw',isa => 'Str',lazy_build => 1,);sub _build_".st."attr".et." {my $self = shift;".st.et."}" exec "Snippet sub sub ".st."name".et." {my $self = shift;".st.et."}"