Permalink
Browse files

has_analyzer|tokenizer|etc should accept a hashref or a list

  • Loading branch information...
clintongormley committed Jul 3, 2012
1 parent f77a420 commit 9e1fe1998c90d0ed59e5ac38afa09147ad00f90c
Showing with 20 additions and 5 deletions.
  1. +20 −5 lib/Elastic/Model.pm
View
@@ -46,11 +46,26 @@ sub override_classes {
}
#===================================
sub has_analyzer { shift->add_analyzer( shift, {@_} ) }
sub has_tokenizer { shift->add_tokenizer( shift, {@_} ) }
sub has_filter { shift->add_filter( shift, {@_} ) }
sub has_char_filter { shift->add_char_filter( shift, {@_} ) }
#==================================
sub has_analyzer {
#===================================
shift->add_analyzer( shift, ref $_[0] eq 'HASH' ? shift() : {@_} );
}
#===================================
sub has_tokenizer {
#===================================
shift->add_tokenizer( shift, ref $_[0] eq 'HASH' ? shift() : {@_} );
}
#===================================
sub has_filter {
#===================================
shift->add_filter( shift, ref $_[0] eq 'HASH' ? shift() : {@_} );
}
#===================================
sub has_char_filter {
#===================================
shift->add_char_filter( shift, ref $_[0] eq 'HASH' ? shift() : {@_} );
}
1;

0 comments on commit 9e1fe19

Please sign in to comment.