-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from agavrelyuk/feature/README
Update README
- Loading branch information
Showing
2 changed files
with
73 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
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. | ||
|
||
# Installation | ||
|
||
You could either use ruby gems and install it via | ||
|
||
```bash | ||
gem install CFPropertyList | ||
``` | ||
|
||
or you could clone this repository and place it somewhere in your load path. | ||
|
||
Example: | ||
```ruby | ||
require 'cfpropertylist' | ||
``` | ||
|
||
If you're using Rails, you can add it into your Gemfile | ||
|
||
```ruby | ||
gem 'CFPropertyList' | ||
``` | ||
|
||
# Usage | ||
|
||
## create a arbitrary data structure of basic data types | ||
|
||
```ruby | ||
data = { | ||
'name' => 'John Doe', | ||
'missing' => true, | ||
'last_seen' => Time.now, | ||
'friends' => ['Jane Doe','Julian Doe'], | ||
'likes' => { | ||
'me' => false | ||
} | ||
} | ||
``` | ||
|
||
## create CFPropertyList::List object | ||
|
||
```ruby | ||
plist = CFPropertyList::List.new | ||
``` | ||
|
||
## call CFPropertyList.guess() to create corresponding CFType values | ||
|
||
```ruby | ||
plist.value = CFPropertyList.guess(data) | ||
``` | ||
|
||
## write plist to file | ||
```ruby | ||
plist.save("example.plist", CFPropertyList::List::FORMAT_BINARY) | ||
``` | ||
|
||
## … later, read it again | ||
```ruby | ||
plist = CFPropertyList::List.new(:file => "example.plist") | ||
data = CFPropertyList.native_types(plist.value) | ||
``` | ||
|
||
# Author and license | ||
|
||
**Author:** Christian Kruse (mailto:cjk@wwwtech.de) | ||
|
||
**Copyright:** Copyright (c) 2010 | ||
|
||
**License:** MIT License | ||
|