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.



222
223
224
# File 'lib/rbCFTypes.rb', line 222

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

Instance Method Details

#to_binary(bplist) ⇒ Object

convert to binary



238
239
240
# File 'lib/rbCFTypes.rb', line 238

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

#to_xml(parser) ⇒ Object

convert to XML



227
228
229
230
231
232
233
234
235
# File 'lib/rbCFTypes.rb', line 227

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