class Vines::Stream::State

The base class of Stream state machines. States know how to process XML nodes and advance to their next valid state or fail the stream.

Attributes

stream[RW]

Public Class Methods

new(stream, success=nil) click to toggle source
# File lib/vines/stream/state.rb, line 15
def initialize(stream, success=nil)
  @stream, @success = stream, success
end

Public Instance Methods

==(state) click to toggle source
# File lib/vines/stream/state.rb, line 23
def ==(state)
  self.class == state.class
end
eql?(state) click to toggle source
# File lib/vines/stream/state.rb, line 27
def eql?(state)
  state.is_a?(State) && self == state
end
hash() click to toggle source
# File lib/vines/stream/state.rb, line 31
def hash
  self.class.hash
end
node(node) click to toggle source
# File lib/vines/stream/state.rb, line 19
def node(node)
  raise 'subclass must implement'
end

Private Instance Methods

advance() click to toggle source
# File lib/vines/stream/state.rb, line 37
def advance
  stream.advance(@success.new(stream))
end
to_stanza(node) click to toggle source
Calls superclass method Vines::Node#to_stanza
# File lib/vines/stream/state.rb, line 41
def to_stanza(node)
  super(node, stream)
end