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.



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

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

Instance Method Details

#to_binary(bplist) ⇒ Object

convert to binary



242
243
244
# File 'lib/rbCFTypes.rb', line 242

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

#to_xml(parser) ⇒ Object

convert to XML



231
232
233
234
235
236
237
238
239
# File 'lib/rbCFTypes.rb', line 231

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