forked from ckruse/CFPropertyList
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME
36 lines (28 loc) · 1007 Bytes
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
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 (mailto:[email protected])
Copyright:: Copyright (c) 2010
License:: MIT License