Class: Vines::Stream::Http::Ready

Inherits:
Client::Ready show all
Defined in:
lib/vines/stream/http/ready.rb

Constant Summary

Constants inherited from State

State::BODY, State::STREAM

Instance Attribute Summary

Attributes inherited from State

#stream

Instance Method Summary collapse

Methods inherited from State

#==, #eql?, #hash, #initialize

Methods included from Log

#log

Constructor Details

This class inherits a constructor from Vines::Stream::State

Instance Method Details

#node(node) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/vines/stream/http/ready.rb', line 9

def node(node)
  unless stream.valid_session?(node[SID]) && body?(node) && node[RID]
    raise StreamErrors::NotAuthorized
  end
  stream.parse_body(node).each do |child|
    begin
      super(child)
    rescue StanzaError => e
      stream.error(e)
    end
  end
  stream.terminate if terminate?(node)
end

#terminate?(node) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/vines/stream/http/ready.rb', line 23

def terminate?(node)
  node[TYPE] == TERMINATE
end