| Class | Jabber::Dataforms::XData |
| In: |
lib/xmpp4r/dataforms/x/data.rb
|
| Parent: | X |
# File lib/xmpp4r/dataforms/x/data.rb, line 15
15: def initialize(type=nil)
16: super()
17: self.type = type
18: end
Search a field by it‘s var-name
| var: | [String] |
| result: | [XDataField] or [nil] |
# File lib/xmpp4r/dataforms/x/data.rb, line 24
24: def field(var)
25: each_element { |xe|
26: return xe if xe.kind_of?(XDataField) and xe.var == var
27: }
28: nil
29: end
# File lib/xmpp4r/dataforms/x/data.rb, line 31
31: def fields
32: fields = []
33: each_element do |xe|
34: if xe.kind_of?(XDataField) and xe.type != :hidden and xe.type != :fixed
35: fields << xe
36: end
37: end
38: fields
39: end
Type of this Data Form
| result: | * :cancel
|
# File lib/xmpp4r/dataforms/x/data.rb, line 48
48: def type
49: case attributes['type']
50: when 'cancel' then :cancel
51: when 'form' then :form
52: when 'result' then :result
53: when 'submit' then :submit
54: else nil
55: end
56: end
# File lib/xmpp4r/dataforms/x/data.rb, line 60
60: def type=(t)
61: case t
62: when :cancel then attributes['type'] = 'cancel'
63: when :form then attributes['type'] = 'form'
64: when :result then attributes['type'] = 'result'
65: when :submit then attributes['type'] = 'submit'
66: else attributes['type'] = nil
67: end
68: end