Class | Jabber::Dataforms::XData |
In: |
lib/xmpp4r/dataforms/x/data.rb
|
Parent: | X |
# File lib/xmpp4r/dataforms/x/data.rb, line 13 13: def initialize(type=nil) 14: super() 15: add_namespace('jabber:x:data') 16: self.type = type 17: end
Search a field by it‘s var-name
var: | [String] |
result: | [XDataField] or [nil] |
# File lib/xmpp4r/dataforms/x/data.rb, line 38 38: def field(var) 39: each_element { |xe| 40: return xe if xe.kind_of?(XDataField) and xe.var == var 41: } 42: nil 43: end
Type of this Data Form
result: | * :cancel
|
# File lib/xmpp4r/dataforms/x/data.rb, line 52 52: def type 53: case attributes['type'] 54: when 'cancel' then :cancel 55: when 'form' then :form 56: when 'result' then :result 57: when 'submit' then :submit 58: else nil 59: end 60: end
# File lib/xmpp4r/dataforms/x/data.rb, line 64 64: def type=(t) 65: case t 66: when :cancel then attributes['type'] = 'cancel' 67: when :form then attributes['type'] = 'form' 68: when :result then attributes['type'] = 'result' 69: when :submit then attributes['type'] = 'submit' 70: else attributes['type'] = nil 71: end 72: end
# File lib/xmpp4r/dataforms/x/data.rb, line 19 19: def typed_add(xe) 20: if xe.kind_of?(REXML::Element) 21: case xe.name 22: when 'instructions' then super XDataInstructions.new.import(xe) 23: when 'title' then super XDataTitle.new.import(xe) 24: when 'field' then super XDataField.new.import(xe) 25: when 'reported' then super XDataReported.new.import(xe) 26: #when 'item' then super XDataItem.new.import(xe) 27: else super xe 28: end 29: else 30: super xe 31: end 32: end