Class: Plist::PDict

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

Instance Attribute Summary

Attributes inherited from PTag

#children, #text

Instance Method Summary collapse

Methods inherited from PTag

inherited, #initialize, mappings

Constructor Details

This class inherits a constructor from Plist::PTag

Instance Method Details

#to_rubyObject



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/facter/util/plist/parser.rb', line 141

def to_ruby
  dict = Hash.new
  key = nil

  children.each do |c|
    if key.nil?
      key = c.to_ruby
    else
      dict[key] = c.to_ruby
      key = nil
    end
  end

  dict
end