Class: TkXML::REXML_Listener
- Inherits:
-
Object
- Object
- TkXML::REXML_Listener
- Defined in:
- lib/tkxml/rexml.rb
Overview
REXML Listener
Instance Attribute Summary collapse
-
#tk ⇒ Object
readonly
Returns the value of attribute tk.
Instance Method Summary collapse
-
#initialize(tk) ⇒ REXML_Listener
constructor
A new instance of REXML_Listener.
- #tag_end(name) ⇒ Object
- #tag_start(name, attributes) ⇒ Object
- #text(free_radical) ⇒ Object
Constructor Details
#initialize(tk) ⇒ REXML_Listener
Returns a new instance of REXML_Listener.
18 19 20 21 |
# File 'lib/tkxml/rexml.rb', line 18 def initialize(tk) super() @tk = tk end |
Instance Attribute Details
#tk ⇒ Object (readonly)
Returns the value of attribute tk.
15 16 17 |
# File 'lib/tkxml/rexml.rb', line 15 def tk @tk end |
Instance Method Details
#tag_end(name) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/tkxml/rexml.rb', line 44 def tag_end(name) # pull off the tag name if prefixed with the Tk namespace if name[0..2] == "Tk:" tag_name = name[3..name.length] else tag_name = name end # if method then we're finish # else if widget then finish creation and pop off the widget stack if tag_name[0..0] == "_" name = tag_name[1..tag_name.length] tk.end_method(name) else tk.(name) end end |
#tag_start(name, attributes) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/tkxml/rexml.rb', line 24 def tag_start(name, attributes) tk.start ## pull off the tag name if prefixed with the Tk namespace if name[0..2] == "Tk:" tag_name = name[3..name.length] else tag_name = name end ## is it a method call or a new widget? if tag_name[0..0] == '_' name = tag_name[1..tag_name.length] tk.start_method(name, attributes) else tk.(name, attributes) end end |
#text(free_radical) ⇒ Object
63 64 65 66 67 |
# File 'lib/tkxml/rexml.rb', line 63 def text(free_radical) if not free_radical.strip == "" puts "Error: TkXML does not use XML text entries: #{free_radical}" end end |