/
Plist4r.html
635 lines (411 loc) · 19.1 KB
/
Plist4r.html
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
36
37
38
39
40
41
42
43
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
<!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>
»
<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/plist.rb,<br /> lib/plist4r/config.rb,<br /> lib/plist4r/options.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/mixin/popen4.rb,<br /> lib/plist4r/backend_base.rb,<br /> lib/plist4r/plist_type/info.rb,<br /> lib/plist4r/plist_type/plist.rb,<br /> lib/plist4r/mixin/array_dict.rb,<br /> lib/plist4r/mixin/mixlib_cli.rb,<br /> lib/plist4r/backend/test/data.rb,<br /> lib/plist4r/plist_type/launchd.rb,<br /> lib/plist4r/mixin/data_methods.rb,<br /> lib/plist4r/mixin/ordered_hash.rb,<br /> lib/plist4r/mixin/ordered_hash.rb,<br /> lib/plist4r/backend/test/output.rb,<br /> lib/plist4r/mixin/mixlib_config.rb,<br /> lib/plist4r/backend/test/harness.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/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 ‘plist4r/backend’
</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>
—
<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>
—
<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">
73
74
75</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/plist4r.rb', line 73</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, &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'>></span> <span class='comment val'>#<Plist4r::Plist:0x111546c @file_format=nil, ...></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>
—
<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
22</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'>&</span><span class='blk identifier id'>blk</span>
<span class='comment val'># puts args.inspect</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'>&</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, &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'>"example.plist"</span><span class='rparen token'>)</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='comment val'>#<Plist4r::Plist:0x1152d1c @file_format="xml", ...></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>
—
<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>
—
<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">
33
34
35
36</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/plist4r.rb', line 33</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'>&</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'>&</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'>"{ \"key1\" = \"value1\"; \"key2\" = \"value2\"; }"</span><span class='rparen token'>)</span> <span class='assign token'>=</span><span class='gt op'>></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>
—
<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>
—
<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">
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/plist4r.rb', line 45</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='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'>"{"</span><span class='comma token'>,</span><span class='string val'>"("</span>
<span class='symbol val'>:gnustep</span>
<span class='when when kw'>when</span> <span class='string val'>"b"</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'>"<"</span>
<span class='if if kw'>if</span> <span class='string identifier id'>string</span> <span class='match op'>=~</span> <span class='regexp val'>/^\<\?xml/</span> <span class='andop op'>&&</span> <span class='string identifier id'>string</span> <span class='match op'>=~</span> <span class='regexp val'>/\<\!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 Sat Jul 10 18:57:29 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>