class CFPropertyList::CFDictionary

this class contains a hash of values

Public Class Methods

new(value={}) click to toggle source

Create new CFDictonary type.

# File lib/cfpropertylist/rbCFTypes.rb, line 299
def initialize(value={})
  @value = value
end

Public Instance Methods

to_binary(bplist) click to toggle source

convert to binary

# File lib/cfpropertylist/rbCFTypes.rb, line 315
def to_binary(bplist)
  bplist.dict_to_binary(self)
end
to_plain(plist) click to toggle source
# File lib/cfpropertylist/rbCFTypes.rb, line 319
def to_plain(plist)
  str = "{ "
  cfstr = CFString.new()

  @value.each do |k,v|
    cfstr.value = k
    str << cfstr.to_plain(plist) + " = " + v.to_plain(plist) + "; "
  end

  str << "}"
end
to_xml(parser) click to toggle source

convert to XML

# File lib/cfpropertylist/rbCFTypes.rb, line 304
def to_xml(parser)
  n = parser.new_node('dict')
  @value.each_pair do |key, value|
    k = parser.append_node(parser.new_node('key'), parser.new_text(key.to_s))
    n = parser.append_node(n, k)
    n = parser.append_node(n, value.to_xml(parser))
  end
  n
end