Class: Blather::Stanza::DiscoInfo::Feature

Inherits:
XMPPNode show all
Defined in:
lib/blather/stanza/disco/disco_info.rb

Overview

Identity

Constant Summary

Constants inherited from XMPPNode

XMPPNode::BASE_NAMES

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from XMPPNode

class_from_registration, #content_from, import, #inherit, #inherit_attrs, #inspect, #namespace=, #namespace_href, #nokogiri_namespace=, #read_attr, #read_content, register, #remove_child, #remove_children, #set_content_for, #to_stanza, #write_attr

Methods inherited from Nokogiri::XML::Node

#[]=, #attr_set, #find_first, #nokogiri_xpath, #xpath

Class Method Details

.new(node) ⇒ DiscoInfo::Feature .new(var) ⇒ DiscoInfo::Feature

Create a new DiscoInfo::Feature object

Overloads:

  • .new(node) ⇒ DiscoInfo::Feature

    Create a new Feature by importing an XML::Node

    Parameters:

    • node (XML::Node)

      an XML::Node to import

  • .new(var) ⇒ DiscoInfo::Feature

    Create a new feature by var

    Parameters:

    • var (String)

      a the Feautre’s var

Returns:



156
157
158
159
160
161
162
163
164
165
# File 'lib/blather/stanza/disco/disco_info.rb', line 156

def self.new(var)
  new_node = super :feature
  case var
  when Nokogiri::XML::Node
    new_node.inherit var
  else
    new_node.var = var
  end
  new_node
end

Instance Method Details

#eql?(o) ⇒ true, false Also known as: ==

Compare two Feature objects by var

Parameters:

Returns:

  • (true, false)


182
183
184
185
186
187
188
# File 'lib/blather/stanza/disco/disco_info.rb', line 182

def eql?(o)
  unless o.is_a?(self.class)
    raise "Cannot compare #{self.class} with #{o.class}"
  end

  o.var == self.var
end

#varString

The Feature’s var

Returns:

  • (String)


169
170
171
# File 'lib/blather/stanza/disco/disco_info.rb', line 169

def var
  read_attr :var
end

#var=(var) ⇒ Object

Set the Feature’s var

Parameters:

  • var (String)

    the new var



175
176
177
# File 'lib/blather/stanza/disco/disco_info.rb', line 175

def var=(var)
  write_attr :var, var
end