Permalink
Browse files

Optimized the UID checks in new_stub to avoid duplication

  • Loading branch information...
1 parent 68890f2 commit ce1a6ffbab80fb1e2d647f91a372e69b6eb89945 @clintongormley committed Nov 14, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/Elastic/Model/Meta/Class/Doc.pm
@@ -42,10 +42,10 @@ sub new_stub {
my ( $self, $uid, $source ) = @_;
my $obj = $self->stub_initializer->();
- croak "Invalid UID"
- unless $uid && $uid->isa('Elastic::Model::UID') && $uid->from_store;
$obj->_set_uid($uid);
+ croak "Invalid UID" unless $uid->from_store;
+
$obj->_set_source($source) if $source;
$obj->_can_inflate(1);
cast %$obj, $wiz;

0 comments on commit ce1a6ff

Please sign in to comment.