Commits

Anonymous committed 421830b

Extracted a method to check if current.

  • Participants
  • Parent commits 12384af

Comments (0)

Files changed (1)

lib/File/Find/Object.pm

     }
 }
 
+sub _is_top
+{
+    my $self = shift;
+
+    return ($self->_current() eq $self);
+}
+
 sub next {
     my ($self) = @_;
     while (1) {
     my $self = shift;
 
     # TODO : Refactor this check - it appears several times.
-    if ($self eq $self->_current())
+    if ($self->_is_top())
     {
         return 1;
     }
         return 0;
     }
 
-    if ($self eq $current)
+    if ($self->_is_top())
     {
         return 1;
     }
 
     my $current = $self->_current();
 
-    if ($self eq $self->_current())
+    if ($self->_is_top())
     {
         return $self->_curr_file;
     }