Class: Syndication::Atom::Content

Inherits:
Data show all
Defined in:
lib/syndication/atom.rb

Overview

XML or text content

Constant Summary

Constant Summary

Constants inherited from Data

Data::ENTITIES

Instance Attribute Summary (collapse)

Attributes inherited from Data

#data

Instance Method Summary (collapse)

Methods inherited from Data

#html, #html2text, #text2html, #txt, #xhtml

Methods inherited from Container

#parse_date, #store_category, #strip, #tag2method

Constructor Details

- (Content) initialize(parent, tag = nil, attrs = nil)



219
220
221
222
# File 'lib/syndication/atom.rb', line 219

def initialize(parent, tag = nil, attrs = nil)
  @xml = ""
  super
end

Instance Attribute Details

- (Object) xml

The raw XML contents of the content element.



217
218
219
# File 'lib/syndication/atom.rb', line 217

def xml
  @xml
end

Instance Method Details

- (Object) store(tag, obj)



224
225
226
# File 'lib/syndication/atom.rb', line 224

def store(tag, obj)
  #puts "[obj:#{tag}]"
end

- (Object) tag_end(endtag, current)



244
245
246
247
248
249
250
# File 'lib/syndication/atom.rb', line 244

def tag_end(endtag, current)
  if @tag == endtag
    return @parent
  end
  @xml += "</#{endtag}>"
  return self
end

- (Object) tag_start(tag, attrs = nil)



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/syndication/atom.rb', line 228

def tag_start(tag, attrs = nil)
  #puts "[tag:#{tag}]"
  attrlist = ""
  if attrs
    for a in attrs.keys
      if attrlist != ""
        attrlist += " "
      end
      attrlist += "#{a}=\"#{attrs[a]}\""
    end
    @xml += "<#{tag} #{attrlist}>"
  else
    @xml += "<#{tag}>"
  end
end

- (Object) text(s)



252
253
254
255
# File 'lib/syndication/atom.rb', line 252

def text(s)
  #puts "[text:#{s}]"
  @xml += s
end