123456789_123456789_123456789_123456789_123456789_

Class: REXML::Validation::ZeroOrMore

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Optional, State
Instance Chain:
self, Optional, State
Inherits: REXML::Validation::Optional
Defined in: lib/rexml/validation/relaxng.rb

Class Method Summary

State - Inherited

Instance Attribute Summary

State - Inherited

Instance Method Summary

Constructor Details

This class inherits a constructor from REXML::Validation::State

Instance Method Details

#expected

[ GitHub ]

  
# File 'lib/rexml/validation/relaxng.rb', line 303

def expected
  return [ @prior.expected, @events[0] ].flatten if @current == 0
  return [@events[@current]]
end

#next(event)

[ GitHub ]

  
# File 'lib/rexml/validation/relaxng.rb', line 282

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