Class: CFPropertyList::CFDictionary
- Defined in:
- lib/cfpropertylist/rbCFTypes.rb
Overview
this class contains a hash of values
Instance Attribute Summary
Attributes inherited from CFType
Instance Method Summary collapse
-
#initialize(value = {}) ⇒ CFDictionary
constructor
Create new CFDictonary type.
-
#to_binary(bplist) ⇒ Object
convert to binary.
- #to_plain(plist) ⇒ Object
-
#to_xml(parser) ⇒ Object
convert to XML.
Constructor Details
#initialize(value = {}) ⇒ CFDictionary
Create new CFDictonary type.
300 301 302 |
# File 'lib/cfpropertylist/rbCFTypes.rb', line 300 def initialize(value={}) @value = value end |
Instance Method Details
#to_binary(bplist) ⇒ Object
convert to binary
316 317 318 |
# File 'lib/cfpropertylist/rbCFTypes.rb', line 316 def to_binary(bplist) bplist.dict_to_binary(self) end |
#to_plain(plist) ⇒ Object
320 321 322 323 324 325 326 327 328 329 330 |
# File 'lib/cfpropertylist/rbCFTypes.rb', line 320 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) ⇒ Object
convert to XML
305 306 307 308 309 310 311 312 313 |
# File 'lib/cfpropertylist/rbCFTypes.rb', line 305 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 |