Class: CFPropertyList::CFDictionary

Inherits:
CFType
  • Object
show all
Defined in:
lib/rbCFTypes.rb

Overview

this class contains a hash of values

Instance Attribute Summary

Attributes inherited from CFType

#value

Instance Method Summary collapse

Constructor Details

#initialize(value = {}) ⇒ CFDictionary

Create new CFDictonary type.



209
210
211
# File 'lib/rbCFTypes.rb', line 209

def initialize(value={})
  @value = value
end

Instance Method Details

#to_binary(bplist) ⇒ Object

convert to binary



227
228
229
# File 'lib/rbCFTypes.rb', line 227

def to_binary(bplist)
  return bplist.dict_to_binary(self)
end

#to_xmlObject

convert to XML



214
215
216
217
218
219
220
221
222
223
224
# File 'lib/rbCFTypes.rb', line 214

def to_xml
  n = LibXML::XML::Node.new('dict')
  @value.each_pair do
    |key,value|
    k = LibXML::XML::Node.new('key') << LibXML::XML::Node.new_text(key)
    n << k
    n << value.to_xml
  end

  return n
end