Class: Plist::Listener
- Inherits:
-
Object
- Object
- Plist::Listener
- Defined in:
- lib/plist/parser.rb
Instance Attribute Summary collapse
-
#open ⇒ Object
include REXML::StreamListener.
-
#result ⇒ Object
include REXML::StreamListener.
Instance Method Summary collapse
-
#initialize ⇒ Listener
constructor
A new instance of Listener.
- #tag_end(name) ⇒ Object
- #tag_start(name, attributes) ⇒ Object
- #text(contents) ⇒ Object
Constructor Details
#initialize ⇒ Listener
Returns a new instance of Listener.
39 40 41 42 |
# File 'lib/plist/parser.rb', line 39 def initialize @result = nil @open = [] end |
Instance Attribute Details
#open ⇒ Object
include REXML::StreamListener
37 38 39 |
# File 'lib/plist/parser.rb', line 37 def open @open end |
#result ⇒ Object
include REXML::StreamListener
37 38 39 |
# File 'lib/plist/parser.rb', line 37 def result @result end |
Instance Method Details
#tag_end(name) ⇒ Object
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 |
#tag_start(name, attributes) ⇒ Object
44 45 46 |
# File 'lib/plist/parser.rb', line 44 def tag_start(name, attributes) @open.push PTag.mappings[name].new end |
#text(contents) ⇒ Object
48 49 50 |
# File 'lib/plist/parser.rb', line 48 def text(contents) @open.last.text = contents if @open.last end |