Class: Syndication::Atom::Content

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

Overview

XML or text content

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

#initialize(parent, tag = nil, attrs = nil) ⇒ Content

Returns a new instance of Content.



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

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

Instance Attribute Details

#xmlObject

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

#store(tag, obj) ⇒ Object



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

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

#tag_end(endtag, current) ⇒ Object



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

#tag_start(tag, attrs = nil) ⇒ Object



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

#text(s) ⇒ Object



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

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