Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

646 lines (418 sloc) 20.348 kB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta name="Content-Type" content="text/html; charset=utf-8" />
<title>Module: Plist4r</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="css/custom.css" type="text/css" media="screen" charset="utf-8" />
<script type="text/javascript" charset="utf-8">
relpath = '';
if (relpath != '') relpath += '/';
</script>
<base id="base_target" target="_top" />
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/autocomplete.js"></script>
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
<script type="text/javascript" charset="utf-8" src="js/live.js"></script>
</head>
<body>
<script type="text/javascript" charset="utf-8">
if (window.top.frames.main) document.body.className = 'frames';
</script>
<div id="header">
<div id="menu">
<a href="object_index.html" target="_self" title="Index (P)">Index (P)</a>
&raquo;
<span class="title">Plist4r</span>
<div class="noframes">
<span class="title"></span>
<a id="frames_link" class="link_disabled">Frames</a> |
<a target="_top" id="noframes_link" class="link_disabled">No Frames</a>
<span class="title"></span>
</div>
</div>
<div id="search2">
<div class="search2_center">
<form class="search2" onsubmit="return false;" action="">
<input name="q" type="search" placeholder="Search" id="search_box2" size="30" value="" />
</form>
</div>
<script type="text/javascript" charset="utf-8">
$('#search_box2').focus(function(){
var search_index = relpath + 'search_index.json';
jQuery.getJSON(search_index, go_data);
function go_data(adata) {
$('#search_box2').autocomplete(adata, {
width: 300,
matchContains: true,
formatItem: function(item) {
return item.text;
}
}).result(function(event, item) {
if (window.location.search) {
window.location.href = relpath + $(item.href_tag).attr("href");
} else {
location.href = relpath + $(item.href_tag).attr("href");
}
});
}
});
</script>
</div>
<div class="clear"></div>
</div>
<iframe id="search_frame"></iframe>
<div id="content"><h1>Module: Plist4r
</h1>
<div id="info_box">
<dl class="box">
<dt class="r1 last">Defined in:</dt>
<dd class="r1 last">
lib/plist4r.rb<span class="defines">,<br />
lib/plist4r/cli.rb,<br /> lib/plist4r/plist.rb,<br /> lib/plist4r/config.rb,<br /> lib/plist4r/backend.rb,<br /> lib/plist4r/commands.rb,<br /> lib/plist4r/plist_type.rb,<br /> lib/plist4r/plist_cache.rb,<br /> lib/plist4r/application.rb,<br /> lib/plist4r/mixin/table.rb,<br /> lib/plist4r/backend_base.rb,<br /> lib/plist4r/mixin/popen4.rb,<br /> lib/plist4r/mixin/script.rb,<br /> lib/plist4r/plist_type/info.rb,<br /> lib/plist4r/plist_type/plist.rb,<br /> lib/plist4r/mixin/mixlib_cli.rb,<br /> lib/plist4r/mixin/array_dict.rb,<br /> lib/plist4r/backend/ruby_cocoa.rb,<br /> lib/plist4r/mixin/ordered_hash.rb,<br /> lib/plist4r/mixin/ordered_hash.rb,<br /> lib/plist4r/plist_type/launchd.rb,<br /> lib/plist4r/mixin/data_methods.rb,<br /> lib/plist4r/mixin/mixlib_config.rb,<br /> lib/plist4r/backend/test/output.rb,<br /> lib/plist4r/backend/test/harness.rb,<br /> lib/plist4r/backend/test/data_types.rb</span>
</dd>
</dl>
</div>
<div class="clear"></div>
<p class="children">
<h3 class="inherited">Modules</h3>
<ul id="modules_ribbon">
<li class="r1"><a href="Plist4r/ActiveSupport.html" target="_self" title="Plist4r::ActiveSupport (module)">ActiveSupport</a></li>
<li class="r2"><a href="Plist4r/DataMethods.html" target="_self" title="Plist4r::DataMethods (module)">DataMethods</a></li>
<li class="r1"><a href="Plist4r/Mixlib.html" target="_self" title="Plist4r::Mixlib (module)">Mixlib</a></li>
<li class="r2"><a href="Plist4r/Popen4.html" target="_self" title="Plist4r::Popen4 (module)">Popen4</a></li>
</ul>
<h3 class="inherited">Classes</h3>
<ul id="classes_ribbon">
<li class="r1"><a href="Plist4r/Application.html" target="_self" title="Plist4r::Application (class)">Application</a></li>
<li class="r2"><a href="Plist4r/ArrayDict.html" target="_self" title="Plist4r::ArrayDict (class)">ArrayDict</a></li>
<li class="r1"><a href="Plist4r/Backend.html" target="_self" title="Plist4r::Backend (class)">Backend</a></li>
<li class="r2"><a href="Plist4r/CLI.html" target="_self" title="Plist4r::CLI (class)">CLI</a></li>
<li class="r1"><a href="Plist4r/Commands.html" target="_self" title="Plist4r::Commands (class)">Commands</a></li>
<li class="r2"><a href="Plist4r/Config.html" target="_self" title="Plist4r::Config (class)">Config</a></li>
<li class="r1"><a href="Plist4r/OrderedHash.html" target="_self" title="Plist4r::OrderedHash (class)">OrderedHash</a></li>
<li class="r2"><a href="Plist4r/Plist.html" target="_self" title="Plist4r::Plist (class)">Plist</a></li>
<li class="r1"><a href="Plist4r/PlistCache.html" target="_self" title="Plist4r::PlistCache (class)">PlistCache</a></li>
<li class="r2"><a href="Plist4r/PlistType.html" target="_self" title="Plist4r::PlistType (class)">PlistType</a></li>
<li class="r1"><a href="Plist4r/Script.html" target="_self" title="Plist4r::Script (class)">Script</a></li>
<li class="r2"><a href="Plist4r/Table.html" target="_self" title="Plist4r::Table (class)">Table</a></li>
</ul>
</p>
<h3 class="inherited">Class Methods</h3>
<ul id="methods_ribbon">
<li class="r1"><a href="#file_detect_format-class_method" target="_self" title="Plist4r.file_detect_format (method)">file_detect_format</a></li>
<li class="r2"><a href="#new-class_method" target="_self" title="Plist4r.new (method)">new</a></li>
<li class="r1"><a href="#open-class_method" target="_self" title="Plist4r.open (method)">open</a></li>
<li class="r2"><a href="#string_detect_format-class_method" target="_self" title="Plist4r.string_detect_format (method)">string_detect_format</a></li>
</ul>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>
require &#8216;plist4r/backend&#8217;
</p>
</div>
</div>
<div class="tags">
</div>
<div id="class_method_details" class="method_details_list">
<h2>Class Method Details</h2>
<div class="method_details first" id="file_detect_format-class_method">
<p class="signature first"">
+ (<tt>Symbol</tt>) <strong>file_detect_format</strong>(filename)
</p><div class="docstring">
<div class="discussion">
<p>
Given a Plist filename, peek the first few bytes and detect the file format
</p>
</div>
</div>
<div class="tags">
<h3>Parameters:</h3>
<ul class="param">
<li>
<span class='type'>(<tt><a href="String.html" target="_self" title="String (class)">String</a></tt>)</span>
<span class='name'>filename</span>
&mdash;
<div class='inline'><p>
plist file to check
</p>
</div>
</li>
</ul>
<h3>Returns:</h3>
<ul class="return">
<li>
<span class='type'>(<tt>Symbol</tt>)</span>
&mdash;
<div class='inline'><p>
A Symbol representing the plist data type. One of:
Plist4r::Plist.FileFormats
</p>
</div>
</li>
</ul>
<h3>See Also:</h3>
<ul class="see">
<li><a href="#string_detect_format-class_method" target="_self" title="Plist4r.string_detect_format (method)">string_detect_format</a></li>
<li><a href="Plist4r/Plist.html#FileFormats-constant" target="_self" title="Plist4r::Plist::FileFormats (constant)">Plist::FileFormats</a></li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
77
78
79</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/plist4r.rb', line 77</span>
<span class='def def kw'>def</span> <span class='file_detect_format identifier id'>file_detect_format</span> <span class='filename identifier id'>filename</span>
<span class='string_detect_format identifier id'>string_detect_format</span> <span class='File constant id'>File</span><span class='dot token'>.</span><span class='read identifier id'>read</span><span class='lparen token'>(</span><span class='filename identifier id'>filename</span><span class='rparen token'>)</span>
<span class='end end kw'>end</span>
</pre>
</td>
</tr>
</table>
</div>
<div class="method_details " id="new-class_method">
<p class="signature "">
+ (<tt><a href="Plist4r/Plist.html" target="_self" title="Plist4r::Plist (class)">Plist4r::Plist</a></tt>) <strong>new</strong>(*args, &amp;blk)
</p><div class="docstring">
<div class="discussion">
<p>
Calls Plist4r::Plist.new with the supplied arguments and block
</p>
</div>
</div>
<div class="tags">
<div class="examples">
<h3>Examples:</h3>
<h4><div class='inline'><p>
Create new, empty plist
</p>
</div></h4>
<pre class="example code"><span class='Plist4r constant id'>Plist4r</span><span class='dot token'>.</span><span class='new identifier id'>new</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='comment val'>#&lt;Plist4r::Plist:0x111546c @file_format=nil, ...&gt;</span>
</pre>
</div>
<h3>Returns:</h3>
<ul class="return">
<li>
<span class='type'>(<tt><a href="Plist4r/Plist.html" target="_self" title="Plist4r::Plist (class)">Plist4r::Plist</a></tt>)</span>
&mdash;
<div class='inline'><p>
The new Plist object
</p>
</div>
</li>
</ul>
<h3>See Also:</h3>
<ul class="see">
<li><a href="Plist4r/Plist.html#initialize-instance_method" target="_self" title="Plist4r::Plist#initialize (method)">Plist#initialize</a></li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
19
20
21</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/plist4r.rb', line 19</span>
<span class='def def kw'>def</span> <span class='new identifier id'>new</span> <span class='mult op'>*</span><span class='args identifier id'>args</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='blk identifier id'>blk</span>
<span class='return return kw'>return</span> <span class='Plist constant id'>Plist</span><span class='dot token'>.</span><span class='new identifier id'>new</span> <span class='mult op'>*</span><span class='args identifier id'>args</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='blk identifier id'>blk</span>
<span class='end end kw'>end</span>
</pre>
</td>
</tr>
</table>
</div>
<div class="method_details " id="open-class_method">
<p class="signature "">
+ (<tt><a href="Plist4r/Plist.html" target="_self" title="Plist4r::Plist (class)">Plist4r::Plist</a></tt>) <strong>open</strong>(filename, *args, &amp;blk)
</p><div class="docstring">
<div class="discussion">
<p>
Opens a plist file
</p>
</div>
</div>
<div class="tags">
<div class="examples">
<h3>Examples:</h3>
<h4><div class='inline'><p>
Load from file
</p>
</div></h4>
<pre class="example code"><span class='Plist4r constant id'>Plist4r</span><span class='dot token'>.</span><span class='open identifier id'>open</span><span class='lparen token'>(</span><span class='string val'>&quot;example.plist&quot;</span><span class='rparen token'>)</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='comment val'>#&lt;Plist4r::Plist:0x1152d1c @file_format=&quot;xml&quot;, ...&gt;</span>
</pre>
</div>
<h3>Parameters:</h3>
<ul class="param">
<li>
<span class='type'>(<tt><a href="String.html" target="_self" title="String (class)">String</a></tt>)</span>
<span class='name'>filename</span>
&mdash;
<div class='inline'><p>
plist file to load
</p>
</div>
</li>
</ul>
<h3>Returns:</h3>
<ul class="return">
<li>
<span class='type'>(<tt><a href="Plist4r/Plist.html" target="_self" title="Plist4r::Plist (class)">Plist4r::Plist</a></tt>)</span>
&mdash;
<div class='inline'><p>
The loaded Plist object
</p>
</div>
</li>
</ul>
<h3>See Also:</h3>
<ul class="see">
<li><a href="Plist4r/Plist.html#initialize-instance_method" target="_self" title="Plist4r::Plist#initialize (method)">Plist#initialize</a></li>
<li><a href="Plist4r/Plist.html#open-instance_method" target="_self" title="Plist4r::Plist#open (method)">Plist#open</a></li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
32
33
34
35</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/plist4r.rb', line 32</span>
<span class='def def kw'>def</span> <span class='open identifier id'>open</span> <span class='filename identifier id'>filename</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='args identifier id'>args</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='blk identifier id'>blk</span>
<span class='p identifier id'>p</span> <span class='assign token'>=</span> <span class='Plist constant id'>Plist</span><span class='dot token'>.</span><span class='new identifier id'>new</span> <span class='filename identifier id'>filename</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='args identifier id'>args</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='blk identifier id'>blk</span>
<span class='p identifier id'>p</span><span class='dot token'>.</span><span class='open identifier id'>open</span>
<span class='end end kw'>end</span>
</pre>
</td>
</tr>
</table>
</div>
<div class="method_details " id="string_detect_format-class_method">
<p class="signature "">
+ (<tt>Symbol</tt>) <strong>string_detect_format</strong>(string)
</p><div class="docstring">
<div class="discussion">
<p>
Given an string of Plist data, peek the first few bytes and detect the file
format
</p>
</div>
</div>
<div class="tags">
<div class="examples">
<h3>Examples:</h3>
<h4><div class='inline'></div></h4>
<pre class="example code"><span class='Plist4r constant id'>Plist4r</span><span class='dot token'>.</span><span class='string_detect_format identifier id'>string_detect_format</span><span class='lparen token'>(</span><span class='string val'>&quot;{ \&quot;key1\&quot; = \&quot;value1\&quot;; \&quot;key2\&quot; = \&quot;value2\&quot;; }&quot;</span><span class='rparen token'>)</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='symbol val'>:gnustep</span>
</pre>
</div>
<h3>Parameters:</h3>
<ul class="param">
<li>
<span class='type'>(<tt><a href="String.html" target="_self" title="String (class)">String</a></tt>)</span>
<span class='name'>string</span>
&mdash;
<div class='inline'><p>
of plist data
</p>
</div>
</li>
</ul>
<h3>Returns:</h3>
<ul class="return">
<li>
<span class='type'>(<tt>Symbol</tt>)</span>
&mdash;
<div class='inline'><p>
A Symbol representing the plist data type. One of:
Plist4r::Plist.FileFormats
</p>
</div>
</li>
</ul>
<h3>See Also:</h3>
<ul class="see">
<li><a href="Plist4r/Plist.html#FileFormats-constant" target="_self" title="Plist4r::Plist::FileFormats (constant)">Plist::FileFormats</a></li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/plist4r.rb', line 44</span>
<span class='def def kw'>def</span> <span class='string_detect_format identifier id'>string_detect_format</span> <span class='string identifier id'>string</span>
<span class='if if kw'>if</span> <span class='RUBY_VERSION constant id'>RUBY_VERSION</span> <span class='geq op'>&gt;=</span> <span class='string val'>'1.9'</span>
<span class='string identifier id'>string</span> <span class='assign token'>=</span> <span class='string identifier id'>string</span><span class='dot token'>.</span><span class='force_encoding identifier id'>force_encoding</span><span class='lparen token'>(</span><span class='Encoding constant id'>Encoding</span><span class='colon2 op'>::</span><span class='ASCII_8BIT constant id'>ASCII_8BIT</span><span class='rparen token'>)</span>
<span class='end end kw'>end</span>
<span class='string identifier id'>string</span><span class='dot token'>.</span><span class='strip! fid id'>strip!</span> <span class='if if_mod kw'>if</span> <span class='string identifier id'>string</span><span class='lbrack token'>[</span><span class='integer val'>0</span><span class='comma token'>,</span><span class='integer val'>1</span><span class='rbrack token'>]</span> <span class='match op'>=~</span> <span class='regexp val'>/\s/</span>
<span class='case case kw'>case</span> <span class='string identifier id'>string</span><span class='lbrack token'>[</span><span class='integer val'>0</span><span class='comma token'>,</span><span class='integer val'>1</span><span class='rbrack token'>]</span>
<span class='when when kw'>when</span> <span class='string val'>&quot;{&quot;</span><span class='comma token'>,</span><span class='string val'>&quot;(&quot;</span>
<span class='symbol val'>:gnustep</span>
<span class='when when kw'>when</span> <span class='string val'>&quot;b&quot;</span>
<span class='if if kw'>if</span> <span class='string identifier id'>string</span> <span class='match op'>=~</span> <span class='regexp val'>/^bplist/</span>
<span class='symbol val'>:binary</span>
<span class='else else kw'>else</span>
<span class='nil nil kw'>nil</span>
<span class='end end kw'>end</span>
<span class='when when kw'>when</span> <span class='string val'>&quot;&lt;&quot;</span>
<span class='if if kw'>if</span> <span class='string identifier id'>string</span> <span class='match op'>=~</span> <span class='regexp val'>/^\&lt;\?xml/</span> <span class='andop op'>&amp;&amp;</span> <span class='string identifier id'>string</span> <span class='match op'>=~</span> <span class='regexp val'>/\&lt;\!DOCTYPE plist/</span>
<span class='symbol val'>:xml</span>
<span class='else else kw'>else</span>
<span class='nil nil kw'>nil</span>
<span class='end end kw'>end</span>
<span class='else else kw'>else</span>
<span class='nil nil kw'>nil</span>
<span class='end end kw'>end</span>
<span class='end end kw'>end</span>
</pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Wed Aug 18 16:27:54 2010 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
0.5.8 and the
<a href="http://github.com/dreamcat4/yard-slipstream">yard-slipstream</a> plugin
(ruby-1.8.7).
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.