class Blather::Stanza::Iq::Si::Si::Feature

Feature stanza fragment

Public Class Methods

find_or_create(parent) click to toggle source

Find or create feature node in si node and converts it to Si::Si::Feature

@param [Si::Si] parent a si node where to find or create feature

@return [Si::Si::Feature]

# File lib/blather/stanza/iq/si.rb, line 192
def self.find_or_create(parent)
  if found_feature = parent.find_first('//ns:feature', :ns => self.registered_ns)
    feature = self.new found_feature
    found_feature.remove
  else
    feature = self.new
  end
  parent << feature

  feature
end
new(node = nil) click to toggle source

Create a new Si::Si::Feature object

@param [XML::Node, nil] node a node to inherit from

@return [Si::Si::Feature]

Calls superclass method
# File lib/blather/stanza/iq/si.rb, line 180
def self.new(node = nil)
  new_node = super :feature
  new_node.namespace = self.registered_ns
  new_node.inherit node if node
  new_node
end

Public Instance Methods

x() click to toggle source

Find or create x node

@return [Stanza::X]

# File lib/blather/stanza/iq/si.rb, line 207
def x
  Stanza::X.find_or_create self
end