class TkXML::Nokogiri_Listener

Attributes

tk[R]

Public Class Methods

new(tk) click to toggle source
Calls superclass method
# File lib/tkxml/nokogiri.rb, line 18
def initialize(tk)
  super()
  @tk = tk
end

Public Instance Methods

end_element(name) click to toggle source
# File lib/tkxml/nokogiri.rb, line 42
def end_element(name)
  ## pull off the tag name if prefixed with the Tk namespace
  name = name.sub(/^Tk:/, '')

  # if method then we're finish
  # else if widget then finish creation and pop off the widget stack
  if name[0..0] == "_"
    name = name[1..-1]
    tk.end_method(name)
  else
    tk.end_widget(name)
  end
end
start_element(name, attrs=[]) click to toggle source
# File lib/tkxml/nokogiri.rb, line 24
def start_element(name, attrs=[])
  tk.start

  ## pull off the tag name if prefixed with the Tk namespace
  name  = name.sub(/^Tk:/, '')

  attrs = Hash[*attrs.flatten]

  ## is it a method call or a new widget?
  if name[0..0] == '_'
    name = name[1..-1]
    tk.start_method(name, attrs)
  else
    tk.start_widget(name, attrs)
  end
end