class RSS::OxListener

Public Instance Methods

attr(name, str) click to toggle source
# File lib/rss/ox.rb, line 36
def attr(name, str)
  @attr[name.to_s] = str
end
cdata(str) click to toggle source
# File lib/rss/ox.rb, line 43
def cdata(str)
  text(str)
end
comment(str) click to toggle source
# File lib/rss/ox.rb, line 41
def comment(str); end
doctype(str) click to toggle source
# File lib/rss/ox.rb, line 40
def doctype(str); end
end_element(name) click to toggle source
# File lib/rss/ox.rb, line 59
def end_element(name)
  ensure_start
  tag_end name
end
end_instruct(target) click to toggle source
# File lib/rss/ox.rb, line 22
def end_instruct(target)
  if target == 'xml'
    xmldecl(@attr['version'], nil, @attr['standalone'] == 'yes')
    if @attr['encoding']
      @xml_enc = @attr['encoding']
      @encoding = 'UTF-8'
    end
  else
    content=''
    @attr.each { |k,v| content<<"#{k}=\"#{v}\" " }
    instruction target, content
  end
end
instruct(target) click to toggle source
# File lib/rss/ox.rb, line 18
def instruct(target)
  @attr={}
end
start_element(name) click to toggle source
# File lib/rss/ox.rb, line 53
def start_element(name)
  ensure_start

  @attr = {}
  @started = name
end
text(str) click to toggle source
Calls superclass method
# File lib/rss/ox.rb, line 47
def text(str)
  ensure_start
  str.encode!(@encoding,@xml_enc) if @xml_enc
  super(str)
end

Private Instance Methods

ensure_start() click to toggle source
# File lib/rss/ox.rb, line 65
def ensure_start
  if @started
    tag_start @started, @attr
    @started = nil
  end
end