Class: Plist::Listener

Inherits:
Object
  • Object
show all
Defined in:
lib/facter/util/plist/parser.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Listener) initialize

Returns a new instance of Listener



37
38
39
40
# File 'lib/facter/util/plist/parser.rb', line 37

def initialize
    @result = nil
    @open   = Array.new
end

Instance Attribute Details

- (Object) open

include REXML::StreamListener



35
36
37
# File 'lib/facter/util/plist/parser.rb', line 35

def open
  @open
end

- (Object) result

include REXML::StreamListener



35
36
37
# File 'lib/facter/util/plist/parser.rb', line 35

def result
  @result
end

Instance Method Details

- (Object) tag_end(name)



51
52
53
54
55
56
57
58
# File 'lib/facter/util/plist/parser.rb', line 51

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)



43
44
45
# File 'lib/facter/util/plist/parser.rb', line 43

def tag_start(name, attributes)
    @open.push PTag::mappings[name].new
end

- (Object) text(contents)



47
48
49
# File 'lib/facter/util/plist/parser.rb', line 47

def text( contents )
    @open.last.text = contents if @open.last
end