Class: Plist::Listener
- Inherits:
-
Object
- Object
- Plist::Listener
- Defined in:
- lib/plist/parser.rb
Instance Attribute Summary (collapse)
-
- (Object) open
include REXML::StreamListener.
-
- (Object) result
include REXML::StreamListener.
Instance Method Summary (collapse)
-
- (Listener) initialize
constructor
A new instance of Listener.
- - (Object) tag_end(name)
- - (Object) tag_start(name, attributes)
- - (Object) text(contents)
Constructor Details
- (Listener) initialize
A new instance of Listener
38 39 40 41 |
# File 'lib/plist/parser.rb', line 38 def initialize @result = nil @open = Array.new end |
Instance Attribute Details
- (Object) open
include REXML::StreamListener
36 37 38 |
# File 'lib/plist/parser.rb', line 36 def open @open end |
- (Object) result
include REXML::StreamListener
36 37 38 |
# File 'lib/plist/parser.rb', line 36 def result @result end |
Instance Method Details
- (Object) tag_end(name)
52 53 54 55 56 57 58 59 |
# File 'lib/plist/parser.rb', line 52 def tag_end(name) last = @open.pop if @open.empty? @result = last.to_ruby else @open.last.children.push last end end |
- (Object) tag_start(name, attributes)
44 45 46 |
# File 'lib/plist/parser.rb', line 44 def tag_start(name, attributes) @open.push PTag::mappings[name].new end |
- (Object) text(contents)
48 49 50 |
# File 'lib/plist/parser.rb', line 48 def text( contents ) @open.last.text = contents if @open.last end |