Module: Vines::Node
- Included in:
- Stream::State
- Defined in:
- lib/vines/node.rb
Overview
Utility functions to work with nodes
Constant Summary collapse
- STREAM =
'stream'.freeze
- BODY =
'body'.freeze
Class Method Summary collapse
-
.body?(node) ⇒ Boolean
Check if BOSH body.
-
.namespace(node) ⇒ Object
Get the namespace.
-
.stream?(node) ⇒ Boolean
Check if node starts a new stream.
-
.to_stanza(node, stream) ⇒ Object
Convert to stanza.
Class Method Details
.body?(node) ⇒ Boolean
Check if BOSH body
16 17 18 |
# File 'lib/vines/node.rb', line 16 def body?(node) node.name == BODY && namespace(node) == NAMESPACES[:http_bind] end |
.namespace(node) ⇒ Object
Get the namespace
21 22 23 24 |
# File 'lib/vines/node.rb', line 21 def namespace(node) namespace = node.namespace namespace && namespace.href end |
.stream?(node) ⇒ Boolean
Check if node starts a new stream
11 12 13 |
# File 'lib/vines/node.rb', line 11 def stream?(node) node.name == STREAM && namespace(node) == NAMESPACES[:stream] end |