Module: Blather::Stanza::Presence::C::InstanceMethods

Included in:
Blather::Stanza::Presence::C
Defined in:
lib/blather/stanza/presence/c.rb

Instance Method Summary collapse

Instance Method Details

#cBlather::XMPPNode

C node accessor If a c node exists it will be returned. Otherwise a new node will be created and returned

Returns:



87
88
89
90
91
92
93
# File 'lib/blather/stanza/presence/c.rb', line 87

def c
  unless c = find_first('ns:c', :ns => C.registered_ns)
    self << (c = XMPPNode.new('c', self.document))
    c.namespace = self.class.registered_ns
  end
  c
end

#hashSymbol?

Get the name of the hash

Returns:

  • (Symbol, nil)


54
55
56
# File 'lib/blather/stanza/presence/c.rb', line 54

def hash
  c[:hash] && c[:hash].to_sym
end

#hash=(hash) ⇒ Object

Set the name of the hash

Parameters:

  • hash (String, nil)

    the new hash name



61
62
63
64
65
66
# File 'lib/blather/stanza/presence/c.rb', line 61

def hash=(hash)
  if hash && !VALID_HASH_TYPES.include?(hash.to_s)
    raise ArgumentError, "Invalid Hash Type (#{hash}), use: #{VALID_HASH_TYPES*' '}"
  end
  c[:hash] = hash
end

#inherit(node) ⇒ Object



31
32
33
34
35
# File 'lib/blather/stanza/presence/c.rb', line 31

def inherit(node)
  c.remove
  super
  self
end

#nodeString?

Get the name of the node

Returns:

  • (String, nil)


40
41
42
# File 'lib/blather/stanza/presence/c.rb', line 40

def node
  c[:node]
end

#node=(node) ⇒ Object

Set the name of the node

Parameters:

  • node (String, nil)

    the new node name



47
48
49
# File 'lib/blather/stanza/presence/c.rb', line 47

def node=(node)
  c[:node] = node
end

#verString?

Get the ver

Returns:

  • (String, nil)


71
72
73
# File 'lib/blather/stanza/presence/c.rb', line 71

def ver
  c[:ver]
end

#ver=(ver) ⇒ Object

Set the ver

Parameters:

  • ver (String, nil)

    the new ver



78
79
80
# File 'lib/blather/stanza/presence/c.rb', line 78

def ver=(ver)
  c[:ver] = ver
end