Class: Stupeflixclient::StupeflixXMLNode

Inherits:
Object
  • Object
show all
Defined in:
lib/stupeflixclient/stupeflix_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(nodeName, attributes = nil, children = nil, text = nil) ⇒ StupeflixXMLNode

Returns a new instance of StupeflixXMLNode.



201
202
203
204
205
206
# File 'lib/stupeflixclient/stupeflix_client.rb', line 201

def initialize( nodeName, attributes = nil, children = nil, text = nil)
  @children = children
  @attributes = attributes
  @nodeName = nodeName
  @text = text
end

Instance Method Details

#metaChildrenAppend(meta = nil, notify = nil, children = nil) ⇒ Object



236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/stupeflixclient/stupeflix_client.rb', line 236

def metaChildrenAppend( meta = nil, notify = nil, children = nil)
  childrenArray = []
  if meta
    childrenArray += [meta]
  end
  if notify
    childrenArray += [notify]
  end
  if children
    childrenArray += children
  end
  return childrenArray
end

#xmlGetObject



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/stupeflixclient/stupeflix_client.rb', line 208

def xmlGet
  docXML = '<' + @nodeName
  if @attributes and @attributes.length != 0

    @attributes.each_pair do |k, v|
      docXML += " "
      if v == nil
        v = ""
      end
      k = k.to_s
      v = v.to_s
      docXML += k + '="' + CGI.escapeHTML(v) + '"'
    end
  end
  docXML += '>'
  if @children
    for c in @children
      docXML += c.xmlGet
    end
  end
  if @text
    docXML += @text
  end
  docXML += '</' + @nodeName + '>'

  return docXML
end