Module CFPropertyList
In: lib/cfpropertylist/rbCFTypes.rb
lib/cfpropertylist/rbCFPropertyList.rb
lib/cfpropertylist/rbLibXMLParser.rb
lib/cfpropertylist/rbREXMLParser.rb
lib/cfpropertylist/rbBinaryCFPropertyList.rb
lib/cfpropertylist/rbPlainCFPropertyList.rb
lib/cfpropertylist/rbNokogiriParser.rb

CFPropertyList implementation

class to read, manipulate and write both XML and binary property list files (plist(5)) as defined by Apple. Have a look at CFPropertyList::List for more documentation.

Example

  require 'cfpropertylist'

  # create a arbitrary data structure of basic data types
  data = {
    'name' => 'John Doe',
    'missing' => true,
    'last_seen' => Time.now,
    'friends' => ['Jane Doe','Julian Doe'],
    'likes' => {
      'me' => false
    }
  }

  # create CFPropertyList::List object
  plist = CFPropertyList::List.new

  # call CFPropertyList.guess() to create corresponding CFType values
  # pass in optional :convert_unknown_to_string => true to convert things like symbols into strings.
  plist.value = CFPropertyList.guess(data)

  # write plist to file
  plist.save("example.plist", CFPropertyList::List::FORMAT_BINARY)

  # … later, read it again
  plist = CFPropertyList::List.new(:file => "example.plist")
  data = CFPropertyList.native_types(plist.value)
Author:Christian Kruse (cjk@wwwtech.de)
Copyright:Copyright (c) 2010
License:MIT License

Methods

Classes and Modules

Class CFPropertyList::Binary
Class CFPropertyList::Blob
Class CFPropertyList::CFArray
Class CFPropertyList::CFBoolean
Class CFPropertyList::CFData
Class CFPropertyList::CFDate
Class CFPropertyList::CFDictionary
Class CFPropertyList::CFInteger
Class CFPropertyList::CFReal
Class CFPropertyList::CFString
Class CFPropertyList::CFType
Class CFPropertyList::CFUid
Class CFPropertyList::LibXMLParser
Class CFPropertyList::List
Class CFPropertyList::NokogiriXMLParser
Class CFPropertyList::ParserInterface
Class CFPropertyList::PlainParser
Class CFPropertyList::ReXMLParser
Class CFPropertyList::UidFixnum
Class CFPropertyList::XMLParserInterface

Attributes

xml_parser_interface  [RW] 

Public Instance methods

Create CFType hierarchy by guessing the correct CFType, e.g.

 x = {
   'a' => ['b','c','d']
 }
 cftypes = CFPropertyList.guess(x)

pass optional options hash. Only possible value actually:

convert_unknown_to_string:Convert unknown objects to string calling to_str()
converter_method:Convert unknown objects to known objects calling method_name
 cftypes = CFPropertyList.guess(x,:convert_unknown_to_string => true,:converter_method => :to_hash, :converter_with_opts => true)

Converts a CFType hiercharchy to native Ruby types

[Validate]