Class: Plist::Listener
- Inherits:
-
Object
- Object
- Plist::Listener
- Defined in:
- lib/searchlink/plist.rb
Instance Attribute Summary collapse
-
#open ⇒ Object
Returns the value of attribute open.
-
#result ⇒ Object
Returns the value of attribute result.
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.
24 25 26 27 |
# File 'lib/searchlink/plist.rb', line 24 def initialize @result = nil @open = [] end |
Instance Attribute Details
#open ⇒ Object
Returns the value of attribute open.
22 23 24 |
# File 'lib/searchlink/plist.rb', line 22 def open @open end |
#result ⇒ Object
Returns the value of attribute result.
22 23 24 |
# File 'lib/searchlink/plist.rb', line 22 def result @result end |
Instance Method Details
#tag_end(_name) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/searchlink/plist.rb', line 37 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
29 30 31 |
# File 'lib/searchlink/plist.rb', line 29 def tag_start(name, _attributes) @open.push PTag.mappings[name].new end |
#text(contents) ⇒ Object
33 34 35 |
# File 'lib/searchlink/plist.rb', line 33 def text(contents) @open.last.text = contents if @open.last end |