sdl4r 0.9.5 → 0.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,6 +1,15 @@
1
- == v0.9.5 (建設中)
1
+ == v0.9.7 (建設中)
2
2
 
3
- == v0.9.6 (8-aug-2010)
3
+ == v0.9.6 (10-aug-2010)
4
+
5
+ === Major changes:
6
+
7
+ * Tag.set_attribute(): fixed as it failed if the value was nil.
8
+ * Tag.write(): now returns the given output (especially necessary if a String was given).
9
+ * Tag.write(): fixed as it failed when writing children without including the root Tag.
10
+ * Tag.write(): it is now possible to give a StringIO as an output
11
+
12
+ == v0.9.5 (8-aug-2010)
4
13
 
5
14
  === Major changes:
6
15
 
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ spec = Gem::Specification.new do |s|
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.summary = "Simple Declarative Language for Ruby library"
12
12
  s.name = 'sdl4r'
13
- s.version = '0.9.5'
13
+ s.version = '0.9.6'
14
14
  s.requirements << 'none'
15
15
  s.require_path = 'lib'
16
16
  s.authors = ['Philippe Vosges', 'Daniel Leuck']
data/TODO CHANGED
@@ -75,4 +75,12 @@
75
75
  ==> Minor change: we return nil for the methods were nothing was really returned explicitely
76
76
  (for the time being).
77
77
  [x] State somewhere that we support SDL 1.3.
78
- [ ] If there is any success, maybe create/recreate the Rubyforge site for the support.
78
+ [ ] If there is any success, maybe create/recreate the Rubyforge site for the support.
79
+ [ ] Should we allow to create a Tag without a name (== "content") for anonymous Tags?
80
+ [ ] It would be cool to be able to right this:
81
+
82
+ Tag.new "toto" do |tag|
83
+ tag << 123
84
+ end
85
+
86
+ Note that instance_eval() doesn't allow to pass parameters right now.
@@ -1,8 +1,11 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
3
6
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
7
  <head>
5
- <title>Module: SDL4R [RDoc: Simple Declarative Language for Ruby]</title>
8
+ <title>Module: SDL4R</title>
6
9
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
10
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
8
11
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
@@ -22,7 +25,7 @@
22
25
  return false;
23
26
 
24
27
  elemStyle = elem.style;
25
-
28
+
26
29
  if ( elemStyle.display != "block" ) {
27
30
  elemStyle.display = "block"
28
31
  } else {
@@ -31,10 +34,10 @@
31
34
 
32
35
  return true;
33
36
  }
34
-
37
+
35
38
  // Make codeblocks hidden by default
36
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }<\/style>" )
37
-
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
38
41
  // ]]>
39
42
  </script>
40
43
 
@@ -42,6 +45,7 @@
42
45
  <body>
43
46
 
44
47
 
48
+
45
49
  <div id="classHeader">
46
50
  <table class="header-table">
47
51
  <tr class="top-aligned-row">
@@ -51,157 +55,88 @@
51
55
  <tr class="top-aligned-row">
52
56
  <td><strong>In:</strong></td>
53
57
  <td>
54
-
55
-
56
58
  <a href="../files/lib/sdl4r/sdl_time_span_rb.html">
57
-
58
59
  lib/sdl4r/sdl_time_span.rb
59
-
60
60
  </a>
61
-
62
-
63
61
  <br />
64
-
65
-
66
62
  <a href="../files/lib/sdl4r/sdl_parse_error_rb.html">
67
-
68
63
  lib/sdl4r/sdl_parse_error.rb
69
-
70
64
  </a>
71
-
72
-
73
65
  <br />
74
-
75
-
76
66
  <a href="../files/lib/sdl4r/tag_rb.html">
77
-
78
67
  lib/sdl4r/tag.rb
79
-
80
68
  </a>
81
-
82
-
83
69
  <br />
84
-
85
-
86
70
  <a href="../files/lib/sdl4r/parser_rb.html">
87
-
88
71
  lib/sdl4r/parser.rb
89
-
90
72
  </a>
91
-
92
-
93
73
  <br />
94
-
95
-
96
74
  <a href="../files/lib/sdl4r/sdl_binary_rb.html">
97
-
98
75
  lib/sdl4r/sdl_binary.rb
99
-
100
76
  </a>
101
-
102
-
103
77
  <br />
104
-
105
-
106
78
  <a href="../files/lib/sdl4r/parser/reader_rb.html">
107
-
108
79
  lib/sdl4r/parser/reader.rb
109
-
110
80
  </a>
111
-
112
-
113
81
  <br />
114
-
115
-
116
82
  <a href="../files/lib/sdl4r/parser/tokenizer_rb.html">
117
-
118
83
  lib/sdl4r/parser/tokenizer.rb
119
-
120
84
  </a>
121
-
122
-
123
85
  <br />
124
-
125
-
126
86
  <a href="../files/lib/sdl4r/parser/token_rb.html">
127
-
128
87
  lib/sdl4r/parser/token.rb
129
-
130
88
  </a>
131
-
132
-
133
89
  <br />
134
-
135
-
136
90
  <a href="../files/lib/sdl4r/parser/time_span_with_zone_rb.html">
137
-
138
91
  lib/sdl4r/parser/time_span_with_zone.rb
139
-
140
92
  </a>
141
-
142
-
143
93
  <br />
144
-
145
-
146
94
  <a href="../files/lib/sdl4r/sdl4r_rb.html">
147
-
148
95
  lib/sdl4r/sdl4r.rb
149
-
150
96
  </a>
151
-
152
-
153
97
  <br />
154
-
155
98
  </td>
156
99
  </tr>
157
100
 
158
-
159
101
  </table>
160
102
  </div>
161
103
  <!-- banner header -->
162
104
 
163
105
  <div id="bodyContent">
164
106
 
107
+
108
+
165
109
  <div id="contextContent">
166
110
 
167
111
  <div id="description">
168
- <hr size="1"></hr><p>
112
+ <p>
169
113
  Gathers utility methods.
170
114
  </p>
171
115
 
172
116
  </div>
173
117
 
174
- </div>
175
118
 
119
+ </div>
176
120
 
177
121
  <div id="method-list">
178
122
  <h3 class="section-bar">Methods</h3>
179
123
 
180
124
  <div class="name-list">
181
-
182
- <a href="#M000001">SdlBinary</a>&nbsp;&nbsp;
183
-
184
- <a href="#M000004">coerce_or_fail</a>&nbsp;&nbsp;
185
-
186
- <a href="#M000002">format</a>&nbsp;&nbsp;
187
-
188
- <a href="#M000003">new_date_time</a>&nbsp;&nbsp;
189
-
190
- <a href="#M000006">read</a>&nbsp;&nbsp;
191
-
192
- <a href="#M000009">to_attribute_map</a>&nbsp;&nbsp;
193
-
194
- <a href="#M000007">to_value</a>&nbsp;&nbsp;
195
-
196
- <a href="#M000008">to_value_array</a>&nbsp;&nbsp;
197
-
198
- <a href="#M000005">validate_identifier</a>&nbsp;&nbsp;
199
-
125
+ <a href="#M000001">SdlBinary</a>&nbsp;&nbsp;
126
+ <a href="#M000004">coerce_or_fail</a>&nbsp;&nbsp;
127
+ <a href="#M000002">format</a>&nbsp;&nbsp;
128
+ <a href="#M000003">new_date_time</a>&nbsp;&nbsp;
129
+ <a href="#M000006">read</a>&nbsp;&nbsp;
130
+ <a href="#M000009">to_attribute_map</a>&nbsp;&nbsp;
131
+ <a href="#M000007">to_value</a>&nbsp;&nbsp;
132
+ <a href="#M000008">to_value_array</a>&nbsp;&nbsp;
133
+ <a href="#M000005">validate_identifier</a>&nbsp;&nbsp;
200
134
  </div>
201
135
  </div>
202
136
 
203
137
  </div>
204
138
 
139
+
205
140
  <!-- if includes -->
206
141
 
207
142
  <div id="section">
@@ -222,91 +157,69 @@ Class <a href="SDL4R/Tag.html" class="link">SDL4R::Tag</a><br />
222
157
 
223
158
  <div class="name-list">
224
159
  <table summary="Constants">
225
-
226
160
  <tr class="top-aligned-row context-row">
227
161
  <td class="context-item-name">MAX_INTEGER_32</td>
228
162
  <td>=</td>
229
163
  <td class="context-item-value">2**31 - 1</td>
230
-
231
164
  </tr>
232
-
233
165
  <tr class="top-aligned-row context-row">
234
166
  <td class="context-item-name">MIN_INTEGER_32</td>
235
167
  <td>=</td>
236
168
  <td class="context-item-value">-(2**31)</td>
237
-
238
169
  </tr>
239
-
240
170
  <tr class="top-aligned-row context-row">
241
171
  <td class="context-item-name">MAX_INTEGER_64</td>
242
172
  <td>=</td>
243
173
  <td class="context-item-value">2**63 - 1</td>
244
-
245
174
  </tr>
246
-
247
175
  <tr class="top-aligned-row context-row">
248
176
  <td class="context-item-name">MIN_INTEGER_64</td>
249
177
  <td>=</td>
250
178
  <td class="context-item-value">-(2**63)</td>
251
-
252
179
  </tr>
253
-
254
180
  <tr class="top-aligned-row context-row">
255
181
  <td class="context-item-name">BASE64_WRAP_LINE_LENGTH</td>
256
182
  <td>=</td>
257
183
  <td class="context-item-value">72</td>
258
-
259
184
  </tr>
260
-
261
185
  <tr class="top-aligned-row context-row">
262
186
  <td class="context-item-name">ESCAPED_QUOTES</td>
263
187
  <td>=</td>
264
188
  <td class="context-item-value">{ &quot;\&quot;&quot; =&gt; &quot;\\\&quot;&quot;, &quot;'&quot; =&gt; &quot;\\'&quot;, &quot;`&quot; =&gt; &quot;\\`&quot;, }</td>
265
-
266
189
  </tr>
267
-
268
190
  <tr class="top-aligned-row context-row">
269
191
  <td class="context-item-name">ESCAPED_CHARS</td>
270
192
  <td>=</td>
271
193
  <td class="context-item-value">{ &quot;\\&quot; =&gt; &quot;\\\\&quot;, &quot;\t&quot; =&gt; &quot;\\t&quot;, &quot;\r&quot; =&gt; &quot;\\r&quot;, &quot;\n&quot; =&gt; &quot;\\n&quot;, }</td>
272
-
273
194
  </tr>
274
-
275
195
  </table>
276
196
  </div>
277
197
  </div>
278
198
 
279
199
 
280
200
 
201
+
281
202
 
282
- <!-- if method_list -->
283
203
 
204
+ <!-- if method_list -->
284
205
  <div id="methods">
285
-
286
206
  <h3 class="section-bar">Public Class methods</h3>
287
207
 
288
-
289
208
  <div id="method-M000001" class="method-detail">
290
209
  <a name="M000001"></a>
291
210
 
292
211
  <div class="method-heading">
293
-
294
212
  <a href="#M000001" class="method-signature">
295
-
296
213
  <span class="method-name">SdlBinary</span><span class="method-args">(o)</span>
297
-
298
214
  </a>
299
-
300
215
  </div>
301
-
216
+
302
217
  <div class="method-description">
303
-
304
218
  <p>
305
219
  Try to coerce &#8216;o&#8217; into a <a
306
220
  href="SDL4R.html#M000001">SdlBinary</a>. Raise an ArgumentError if it
307
221
  fails.
308
222
  </p>
309
-
310
223
  <p><a class="source-toggle" href="#"
311
224
  onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
312
225
  <div class="method-source-code" id="M000001-source">
@@ -323,26 +236,19 @@ fails.
323
236
  <span class="ruby-keyword kw">end</span>
324
237
  </pre>
325
238
  </div>
326
-
327
239
  </div>
328
240
  </div>
329
241
 
330
-
331
242
  <div id="method-M000004" class="method-detail">
332
243
  <a name="M000004"></a>
333
244
 
334
245
  <div class="method-heading">
335
-
336
246
  <a href="#M000004" class="method-signature">
337
-
338
247
  <span class="method-name">coerce_or_fail</span><span class="method-args">(o)</span>
339
-
340
248
  </a>
341
-
342
249
  </div>
343
-
250
+
344
251
  <div class="method-description">
345
-
346
252
  <p>
347
253
  Coerce the type to a standard SDL type or raises an ArgumentError.
348
254
  </p>
@@ -355,7 +261,6 @@ href="SDL4R.html#M000001">SdlBinary</a>,
355
261
  <p>
356
262
  Rationals are turned into Floats using Rational#to_f.
357
263
  </p>
358
-
359
264
  <p><a class="source-toggle" href="#"
360
265
  onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
361
266
  <div class="method-source-code" id="M000004-source">
@@ -386,45 +291,37 @@ Rationals are turned into Floats using Rational#to_f.
386
291
  <span class="ruby-keyword kw">end</span>
387
292
  </pre>
388
293
  </div>
389
-
390
294
  </div>
391
295
  </div>
392
296
 
393
-
394
297
  <div id="method-M000002" class="method-detail">
395
298
  <a name="M000002"></a>
396
299
 
397
300
  <div class="method-heading">
398
-
399
301
  <a href="#M000002" class="method-signature">
400
-
401
302
  <span class="method-name">format</span><span class="method-args">(o, add_quotes = true, line_prefix = &quot;&quot;, indent = &quot;\t&quot;)</span>
402
-
403
303
  </a>
404
-
405
304
  </div>
406
-
305
+
407
306
  <div class="method-description">
408
-
409
307
  <p>
410
308
  Creates an SDL string representation for a given object and returns it.
411
309
  </p>
412
310
  <table>
413
- <tr><td valign="top"><tt>o</tt>:</td><td>the object to format
311
+ <tr><td valign="top"><tt>o</tt>:</td><td>the object to <a href="SDL4R.html#M000002">format</a>
414
312
 
415
313
  </td></tr>
416
314
  <tr><td valign="top"><tt>add_quotes</tt>:</td><td>indicates whether quotes will be added to Strings and characters (true by
417
315
  default)
418
316
 
419
317
  </td></tr>
420
- <tr><td valign="top"><tt>line_prefix</tt>:</td><td>the line prefix to use (&#8220;&#8221; by default)
318
+ <tr><td valign="top"><tt>line_prefix</tt>:</td><td>the line prefix to use (&quot;&quot; by default)
421
319
 
422
320
  </td></tr>
423
- <tr><td valign="top"><tt>indent</tt>:</td><td>the indent string to use (&#8220;t&#8220; by default)
321
+ <tr><td valign="top"><tt>indent</tt>:</td><td>the indent string to use (&quot;\t&quot; by default)
424
322
 
425
323
  </td></tr>
426
324
  </table>
427
-
428
325
  <p><a class="source-toggle" href="#"
429
326
  onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
430
327
  <div class="method-source-code" id="M000002-source">
@@ -516,26 +413,19 @@ default)
516
413
  <span class="ruby-keyword kw">end</span>
517
414
  </pre>
518
415
  </div>
519
-
520
416
  </div>
521
417
  </div>
522
418
 
523
-
524
419
  <div id="method-M000003" class="method-detail">
525
420
  <a name="M000003"></a>
526
421
 
527
422
  <div class="method-heading">
528
-
529
423
  <a href="#M000003" class="method-signature">
530
-
531
424
  <span class="method-name">new_date_time</span><span class="method-args">(year, month, day, hour, min, sec, time_zone_offset)</span>
532
-
533
425
  </a>
534
-
535
426
  </div>
536
-
427
+
537
428
  <div class="method-description">
538
-
539
429
  <p>
540
430
  Creates and returns the object representing a datetime (DateTime in the
541
431
  default implementation). This method is, by default, called by the <a
@@ -550,7 +440,6 @@ parsers.
550
440
  end
551
441
  end
552
442
  </pre>
553
-
554
443
  <p><a class="source-toggle" href="#"
555
444
  onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
556
445
  <div class="method-source-code" id="M000003-source">
@@ -561,28 +450,21 @@ parsers.
561
450
  <span class="ruby-keyword kw">end</span>
562
451
  </pre>
563
452
  </div>
564
-
565
453
  </div>
566
454
  </div>
567
455
 
568
-
569
456
  <div id="method-M000006" class="method-detail">
570
457
  <a name="M000006"></a>
571
458
 
572
459
  <div class="method-heading">
573
-
574
460
  <a href="#M000006" class="method-signature">
575
-
576
461
  <span class="method-name">read</span><span class="method-args">(input)</span>
577
-
578
462
  </a>
579
-
580
463
  </div>
581
-
464
+
582
465
  <div class="method-description">
583
-
584
466
  <p>
585
- Creates and returns a tag named &#8220;root&#8221; and add all the tags
467
+ Creates and returns a tag named &quot;root&quot; and add all the tags
586
468
  specified in the given <tt>input</tt>.
587
469
  </p>
588
470
  <table>
@@ -607,7 +489,6 @@ specified in the given <tt>input</tt>.
607
489
 
608
490
  root = SDL4R::read(URI.new(&quot;http://my_site/my_file.sdl&quot;))
609
491
  </pre>
610
-
611
492
  <p><a class="source-toggle" href="#"
612
493
  onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
613
494
  <div class="method-source-code" id="M000006-source">
@@ -618,26 +499,19 @@ specified in the given <tt>input</tt>.
618
499
  <span class="ruby-keyword kw">end</span>
619
500
  </pre>
620
501
  </div>
621
-
622
502
  </div>
623
503
  </div>
624
504
 
625
-
626
505
  <div id="method-M000009" class="method-detail">
627
506
  <a name="M000009"></a>
628
507
 
629
508
  <div class="method-heading">
630
-
631
509
  <a href="#M000009" class="method-signature">
632
-
633
510
  <span class="method-name">to_attribute_map</span><span class="method-args">(s)</span>
634
-
635
511
  </a>
636
-
637
512
  </div>
638
-
513
+
639
514
  <div class="method-description">
640
-
641
515
  <p>
642
516
  Parse a string representing the attributes portion of an SDL tag and return
643
517
  the results as a map.
@@ -650,7 +524,6 @@ Example
650
524
 
651
525
  # { &quot;value&quot; =&gt; 1, &quot;debugging&quot; =&gt; true, &quot;time&quot; =&gt; SdlTimeSpan.new(12, 24, 01) }
652
526
  </pre>
653
-
654
527
  <p><a class="source-toggle" href="#"
655
528
  onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
656
529
  <div class="method-source-code" id="M000009-source">
@@ -662,26 +535,19 @@ Example
662
535
  <span class="ruby-keyword kw">end</span>
663
536
  </pre>
664
537
  </div>
665
-
666
538
  </div>
667
539
  </div>
668
540
 
669
-
670
541
  <div id="method-M000007" class="method-detail">
671
542
  <a name="M000007"></a>
672
543
 
673
544
  <div class="method-heading">
674
-
675
545
  <a href="#M000007" class="method-signature">
676
-
677
546
  <span class="method-name">to_value</span><span class="method-args">(s)</span>
678
-
679
547
  </a>
680
-
681
548
  </div>
682
-
549
+
683
550
  <div class="method-description">
684
-
685
551
  <p>
686
552
  Parses and returns the value corresponding with the specified SDL literal.
687
553
  </p>
@@ -690,7 +556,6 @@ Parses and returns the value corresponding with the specified SDL literal.
690
556
  SDL4R.to_value(&quot;1&quot;) # =&gt; 1
691
557
  SDL4R.to_value(&quot;null&quot;) # =&gt; nil
692
558
  </pre>
693
-
694
559
  <p><a class="source-toggle" href="#"
695
560
  onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
696
561
  <div class="method-source-code" id="M000007-source">
@@ -702,26 +567,19 @@ Parses and returns the value corresponding with the specified SDL literal.
702
567
  <span class="ruby-keyword kw">end</span>
703
568
  </pre>
704
569
  </div>
705
-
706
570
  </div>
707
571
  </div>
708
572
 
709
-
710
573
  <div id="method-M000008" class="method-detail">
711
574
  <a name="M000008"></a>
712
575
 
713
576
  <div class="method-heading">
714
-
715
577
  <a href="#M000008" class="method-signature">
716
-
717
578
  <span class="method-name">to_value_array</span><span class="method-args">(s)</span>
718
-
719
579
  </a>
720
-
721
580
  </div>
722
-
581
+
723
582
  <div class="method-description">
724
-
725
583
  <p>
726
584
  Parse the string of values and return a list. The string is handled as if
727
585
  it is the values portion of an SDL tag.
@@ -735,7 +593,6 @@ Example
735
593
  <p>
736
594
  Will return an int, a boolean, and a time span.
737
595
  </p>
738
-
739
596
  <p><a class="source-toggle" href="#"
740
597
  onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
741
598
  <div class="method-source-code" id="M000008-source">
@@ -747,26 +604,19 @@ Will return an int, a boolean, and a time span.
747
604
  <span class="ruby-keyword kw">end</span>
748
605
  </pre>
749
606
  </div>
750
-
751
607
  </div>
752
608
  </div>
753
609
 
754
-
755
610
  <div id="method-M000005" class="method-detail">
756
611
  <a name="M000005"></a>
757
612
 
758
613
  <div class="method-heading">
759
-
760
614
  <a href="#M000005" class="method-signature">
761
-
762
615
  <span class="method-name">validate_identifier</span><span class="method-args">(identifier)</span>
763
-
764
616
  </a>
765
-
766
617
  </div>
767
-
618
+
768
619
  <div class="method-description">
769
-
770
620
  <p>
771
621
  Validates an SDL identifier String. SDL Identifiers must start with a
772
622
  Unicode letter or underscore (_) and contain only unicode letters, digits,
@@ -779,7 +629,6 @@ ArgumentError if the identifier is not legal
779
629
  <p>
780
630
  TODO: support UTF-8 identifiers
781
631
  </p>
782
-
783
632
  <p><a class="source-toggle" href="#"
784
633
  onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
785
634
  <div class="method-source-code" id="M000005-source">
@@ -814,22 +663,19 @@ TODO: support UTF-8 identifiers
814
663
  <span class="ruby-keyword kw">end</span>
815
664
  </pre>
816
665
  </div>
817
-
818
666
  </div>
819
667
  </div>
820
668
 
821
669
 
822
-
823
670
  </div>
824
671
 
825
672
 
826
-
827
-
828
673
  </div>
829
674
 
675
+
830
676
  <div id="validator-badges">
831
677
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
832
678
  </div>
833
679
 
834
680
  </body>
835
- </html>
681
+ </html>