Method: REXML::Validation::Interleave#next

Defined in:
lib/rexml/validation/relaxng.rb

#next(event) ⇒ Object



478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
# File 'lib/rexml/validation/relaxng.rb', line 478

def next( event )
  # Find the next series
  next_current(event) unless @events[@current]
  return nil unless @events[@current]

  expand_ref_in( @events, @current ) if @events[@current].class == Ref
  if ( @events[@current].kind_of? State )
    @current += 1
    @events[@current-1].previous = self
    return @events[@current-1].next( event )
  end
  return @previous.pop.next( event ) if @events[@current].nil?
  if ( @events[@current].matches?(event) )
    @current += 1
    if @events[@current].nil?
      return self unless @choices[@choice].nil?
      @previous.pop
    elsif @events[@current].kind_of? State
      @current += 1
      @events[@current-1].previous = self
      @events[@current-1]
    else
      self
    end
  else
    nil
  end
end