Class: Blather::Stanza::Presence::MUCUser::Item

Inherits:
XMPPNode
  • Object
show all
Defined in:
lib/blather/stanza/presence/muc_user.rb

Constant Summary

Constants inherited from XMPPNode

XMPPNode::BASE_NAMES

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from XMPPNode

class_from_registration, #decorate, decorator_modules, import, parse, register, #to_stanza

Class Method Details

.new(affiliation = nil, role = nil, jid = nil, document = nil) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/blather/stanza/presence/muc_user.rb', line 72

def self.new(affiliation = nil, role = nil, jid = nil, document = nil)
  new_node = super :item, document

  case affiliation
  when self
    affiliation.document ||= document
    return affiliation
  when Nokogiri::XML::Node
    new_node.inherit affiliation
  when Hash
    new_node.affiliation = affiliation[:affiliation]
    new_node.role = affiliation[:role]
    new_node.jid = affiliation[:jid]
  else
    new_node.affiliation = affiliation
    new_node.role = role
    new_node.jid = jid
  end
  new_node
end

Instance Method Details

#affiliationObject



93
94
95
# File 'lib/blather/stanza/presence/muc_user.rb', line 93

def affiliation
  read_attr :affiliation, :to_sym
end

#affiliation=(val) ⇒ Object



97
98
99
# File 'lib/blather/stanza/presence/muc_user.rb', line 97

def affiliation=(val)
  write_attr :affiliation, val
end

#jidObject



109
110
111
# File 'lib/blather/stanza/presence/muc_user.rb', line 109

def jid
  read_attr :jid
end

#jid=(val) ⇒ Object



113
114
115
# File 'lib/blather/stanza/presence/muc_user.rb', line 113

def jid=(val)
  write_attr :jid, val
end

#roleObject



101
102
103
# File 'lib/blather/stanza/presence/muc_user.rb', line 101

def role
  read_attr :role, :to_sym
end

#role=(val) ⇒ Object



105
106
107
# File 'lib/blather/stanza/presence/muc_user.rb', line 105

def role=(val)
  write_attr :role, val
end