sdl4r 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/CHANGELOG +28 -0
  2. data/README +9 -0
  3. data/Rakefile +3 -2
  4. data/TODO +78 -0
  5. data/doc/classes/SDL4R.html +207 -53
  6. data/doc/classes/SDL4R/Parser.html +111 -49
  7. data/doc/classes/SDL4R/SdlBinary.html +125 -65
  8. data/doc/classes/SDL4R/SdlParseError.html +52 -30
  9. data/doc/classes/SDL4R/SdlTimeSpan.html +497 -279
  10. data/doc/classes/SDL4R/Tag.html +866 -514
  11. data/doc/created.rid +1 -1
  12. data/doc/files/CHANGELOG.html +52 -25
  13. data/doc/files/LICENSE.html +43 -52
  14. data/doc/files/README.html +52 -43
  15. data/doc/files/lib/sdl4r/parser/reader_rb.html +16 -27
  16. data/doc/files/lib/sdl4r/parser/time_span_with_zone_rb.html +17 -21
  17. data/doc/files/lib/sdl4r/parser/token_rb.html +17 -21
  18. data/doc/files/lib/sdl4r/parser/tokenizer_rb.html +17 -21
  19. data/doc/files/lib/sdl4r/parser_rb.html +21 -22
  20. data/doc/files/lib/sdl4r/sdl4r_rb.html +25 -25
  21. data/doc/files/lib/sdl4r/sdl_binary_rb.html +17 -21
  22. data/doc/files/lib/sdl4r/sdl_parse_error_rb.html +17 -21
  23. data/doc/files/lib/sdl4r/sdl_time_span_rb.html +17 -21
  24. data/doc/files/lib/sdl4r/tag_rb.html +25 -24
  25. data/doc/files/lib/sdl4r_rb.html +17 -21
  26. data/doc/fr_class_index.html +15 -12
  27. data/doc/fr_file_index.html +23 -12
  28. data/doc/fr_method_index.html +176 -91
  29. data/doc/index.html +7 -10
  30. data/doc/rdoc-style.css +210 -119
  31. data/lib/sdl4r.rb +3 -0
  32. data/lib/sdl4r/parser.rb +3 -5
  33. data/lib/sdl4r/parser/reader.rb +3 -3
  34. data/lib/sdl4r/parser/time_span_with_zone.rb +3 -0
  35. data/lib/sdl4r/parser/token.rb +3 -0
  36. data/lib/sdl4r/parser/tokenizer.rb +3 -0
  37. data/lib/sdl4r/sdl4r.rb +20 -8
  38. data/lib/sdl4r/sdl_binary.rb +3 -0
  39. data/lib/sdl4r/sdl_parse_error.rb +3 -0
  40. data/lib/sdl4r/sdl_time_span.rb +3 -0
  41. data/lib/sdl4r/tag.rb +18 -4
  42. data/test/sdl4r/parser_test.rb +7 -2
  43. data/test/sdl4r/sdl4r_test.rb +6 -2
  44. data/test/sdl4r/sdl_test.rb +3 -0
  45. data/test/sdl4r/tag_test.rb +3 -0
  46. metadata +72 -74
  47. data/TODO.txt +0 -177
data/CHANGELOG CHANGED
@@ -1,3 +1,16 @@
1
+ == v0.9.5 (建設中)
2
+
3
+ == v0.9.6 (8-aug-2010)
4
+
5
+ === Major changes:
6
+
7
+ * Fixes in order to make SDL4R work in Ruby 1.9 (mainly concerning encodings and dates).
8
+ * Commented out debug code (writing to files) inside sdl4r_test.rb.
9
+
10
+ === Minor changes:
11
+
12
+ * General & contact info in the README
13
+
1
14
  == v0.9.4 (6-aug-2010)
2
15
 
3
16
  === Major changes:
@@ -11,3 +24,18 @@
11
24
  * SDL4R#coerce_or_fail has been implemented, which means that random objects can't be added to a
12
25
  Tag as before. Rational instances are coerced using Rational#to_f.
13
26
  * Added usual time methods to SdlTimeSpan: day(), hour(), min(), sec(), usec()
27
+
28
+ == v0.9.3
29
+
30
+ === Major changes
31
+
32
+ * Tag: any method that use to take namespace/name parameters now follows the natural order
33
+ "namespace" and then "name":
34
+
35
+ Tag.new "ns1", "tag1"
36
+
37
+ WARNING: this was the contrary before!!!
38
+ Also, the "recursive" parameter should always be at the first place now.
39
+
40
+ * It is now possible to override SDL4R::new_date_time in order to create Time instances when parsing
41
+ rather than DateTime instances.
data/README CHANGED
@@ -1,5 +1,14 @@
1
1
  = SDL (Simple Declarative Language)
2
2
 
3
+ SDL version supported: 1.3
4
+
5
+ Site:: http://www.ikayzo.org/confluence/display/SDL/Home
6
+ Downloads:: http://www.ikayzo.org/confluence/display/SDL/Downloads
7
+
8
+ Users mailing list:: sdl-users@ikayzo.org
9
+ Developers mailing list:: sdl-developers@ikayzo.org
10
+
11
+
3
12
  == Getting Started with SDL4R
4
13
 
5
14
  To get the Ruby Gem:
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.4'
13
+ s.version = '0.9.5'
14
14
  s.requirements << 'none'
15
15
  s.require_path = 'lib'
16
16
  s.authors = ['Philippe Vosges', 'Daniel Leuck']
@@ -51,7 +51,8 @@ Rake::RDocTask.new do |rd|
51
51
  rd.main = 'README'
52
52
  rd.rdoc_files.include(files)
53
53
  rd.rdoc_dir = "doc"
54
- rd.title = "Simple Declarative Language for Ruby"
54
+ rd.title = "RDoc: Simple Declarative Language for Ruby"
55
+ rd.options << '--charset' << 'utf-8'
55
56
  end
56
57
 
57
58
  Rake::TestTask.new do |t|
data/TODO ADDED
@@ -0,0 +1,78 @@
1
+ [x] Is Base64 really compatible with the format defined in the Java version ?
2
+ ==> Seems so after having implemented more of the standard tests.
3
+ [ ] Add more unit tests
4
+ [x] Attribute tests
5
+ [x] Date tests
6
+ [x] Date + time test
7
+ [x] Time zone tests
8
+ [x] Number literal tests
9
+ [x] Strings literals (especially with line continuations)
10
+ [x] Sub tags tests
11
+ [x] "null" value test
12
+ [x] Comment tests
13
+ [ ] Bad syntax tests
14
+ [ ] Test write (unit tests)
15
+ [ ] Dates
16
+ [ ] Numbers
17
+ [A] Use YARD in order to generate documentation ?
18
+ ==> alternatively, I tried to generate some RDoc templates but none worked in Rake...
19
+ [ ] BUG: the line number is too high by 1 (the column is correct).
20
+ [/] Fix the differences between test_basic_types.sdl and what is generated from the parsed structure
21
+ [x] chars
22
+ [x] longs
23
+ [x] doubles
24
+ [x] decimals
25
+ [x] booleans
26
+ [x] null
27
+ [x] dates
28
+ [x] times
29
+ [x] negative times
30
+ [x] datetimes
31
+ [/] zone codes
32
+ ==> Time only works in UTC, which means that the original zone code is lost.
33
+ ==> DateTime doesn't give the zone code but only the offset.
34
+ [ ] Use TzTime? Use a custom object that knows whether a time zone was specified?
35
+ ==> http://tztime.rubyforge.org/
36
+ ==> along with TzInfo: http://tzinfo.rubyforge.org/
37
+ [ ] See how Ruby floats relate to Java floats and doubles.
38
+ [ ] Add tests for the SDL class
39
+ [ ] Allow unicode characters in identifiers.
40
+ [ ] FUTURE: It might be useful to allow people to replace the standard types by their own. This
41
+ could be useful for dates or numbers, for instance.
42
+ [N] To install a gem in the Netbeans gems repository, it needs to run as an administrator.
43
+ Otherwise, it fails silently.
44
+ [ ] FUTURE: Consider being able to read text files that are not UTF-8(?)
45
+ [ ] BUG: the report on the line no in errors is off by 1 (at least in some cases)
46
+ [x] Return copies or original arrays in Tag?
47
+ ==> we return the implementation Arrays or Hashes (or whatever) for efficiency.
48
+ However, we ask the users not to assume anything as we might protect the returned objects in
49
+ the future.
50
+ [ ] Tag.hash: the implementation is not very efficient.
51
+ ==> Difficult to make better and still simple
52
+ ==> Maybe possible when it's frozen.
53
+ [ ] FUTURE: xpath, ypath ==> sdlpath(?)
54
+ [ ] FUTURE: evenemential parsing(?)
55
+ [ ] FUTURE: add a way to insert a tag after or before another(?)
56
+ [ ] FUTURE: allow some way of generating YAML(?)
57
+ [ ] FUTURE: allow to turn a YAML structure into a SDL one(?)
58
+ [ ] BUG: "rake package" tries to archive the contents twice: once with the command that I configure
59
+ in Rakefile, once with a zip command that can't work on my machine (zip is not installed). Why?
60
+ At least, the first archive is created and seems correct.
61
+ [ ] FUTURE: Would we need a "write" method in SDL4R?
62
+ [x] Add tests and release a RC or beta version
63
+ [x] Make the methods of Tag that take a block have a better yield doc/completion
64
+ ==> I added :yields: RDoc directives, which doesn't look like it's helping but I guess that's
65
+ all I can do for now.
66
+ [N] Never call a class "Test" => it can easily conflict with the "Test" module of Test::Unit and
67
+ then, it becomes quite difficult to understand why.
68
+ [ ] Input relevant URLs on http://rubygems.org
69
+ [x] What prevents from doing the following?
70
+ tag.values << IO.new("toto.txt")
71
+ ==> It doesn't break the behavior as long as the value type is OK. Even if it is not allowed,
72
+ it still is not too bad.
73
+ [x] Look at the returned values of method who do not have their return values documented e.g.
74
+ Tag.add_value
75
+ ==> Minor change: we return nil for the methods were nothing was really returned explicitely
76
+ (for the time being).
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.
@@ -1,12 +1,9 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
6
3
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
4
  <head>
8
- <title>Module: SDL4R</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
5
+ <title>Module: SDL4R [RDoc: Simple Declarative Language for Ruby]</title>
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10
7
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
8
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
9
  <script type="text/javascript">
@@ -25,7 +22,7 @@
25
22
  return false;
26
23
 
27
24
  elemStyle = elem.style;
28
-
25
+
29
26
  if ( elemStyle.display != "block" ) {
30
27
  elemStyle.display = "block"
31
28
  } else {
@@ -34,10 +31,10 @@
34
31
 
35
32
  return true;
36
33
  }
37
-
34
+
38
35
  // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
36
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }<\/style>" )
37
+
41
38
  // ]]>
42
39
  </script>
43
40
 
@@ -45,7 +42,6 @@
45
42
  <body>
46
43
 
47
44
 
48
-
49
45
  <div id="classHeader">
50
46
  <table class="header-table">
51
47
  <tr class="top-aligned-row">
@@ -55,88 +51,157 @@
55
51
  <tr class="top-aligned-row">
56
52
  <td><strong>In:</strong></td>
57
53
  <td>
54
+
55
+
58
56
  <a href="../files/lib/sdl4r/sdl_time_span_rb.html">
57
+
59
58
  lib/sdl4r/sdl_time_span.rb
59
+
60
60
  </a>
61
+
62
+
61
63
  <br />
64
+
65
+
62
66
  <a href="../files/lib/sdl4r/sdl_parse_error_rb.html">
67
+
63
68
  lib/sdl4r/sdl_parse_error.rb
69
+
64
70
  </a>
71
+
72
+
65
73
  <br />
74
+
75
+
66
76
  <a href="../files/lib/sdl4r/tag_rb.html">
77
+
67
78
  lib/sdl4r/tag.rb
79
+
68
80
  </a>
81
+
82
+
69
83
  <br />
84
+
85
+
70
86
  <a href="../files/lib/sdl4r/parser_rb.html">
87
+
71
88
  lib/sdl4r/parser.rb
89
+
72
90
  </a>
91
+
92
+
73
93
  <br />
94
+
95
+
74
96
  <a href="../files/lib/sdl4r/sdl_binary_rb.html">
97
+
75
98
  lib/sdl4r/sdl_binary.rb
99
+
76
100
  </a>
101
+
102
+
77
103
  <br />
104
+
105
+
78
106
  <a href="../files/lib/sdl4r/parser/reader_rb.html">
107
+
79
108
  lib/sdl4r/parser/reader.rb
109
+
80
110
  </a>
111
+
112
+
81
113
  <br />
114
+
115
+
82
116
  <a href="../files/lib/sdl4r/parser/tokenizer_rb.html">
117
+
83
118
  lib/sdl4r/parser/tokenizer.rb
119
+
84
120
  </a>
121
+
122
+
85
123
  <br />
124
+
125
+
86
126
  <a href="../files/lib/sdl4r/parser/token_rb.html">
127
+
87
128
  lib/sdl4r/parser/token.rb
129
+
88
130
  </a>
131
+
132
+
89
133
  <br />
134
+
135
+
90
136
  <a href="../files/lib/sdl4r/parser/time_span_with_zone_rb.html">
137
+
91
138
  lib/sdl4r/parser/time_span_with_zone.rb
139
+
92
140
  </a>
141
+
142
+
93
143
  <br />
144
+
145
+
94
146
  <a href="../files/lib/sdl4r/sdl4r_rb.html">
147
+
95
148
  lib/sdl4r/sdl4r.rb
149
+
96
150
  </a>
151
+
152
+
97
153
  <br />
154
+
98
155
  </td>
99
156
  </tr>
100
157
 
158
+
101
159
  </table>
102
160
  </div>
103
161
  <!-- banner header -->
104
162
 
105
163
  <div id="bodyContent">
106
164
 
107
-
108
-
109
165
  <div id="contextContent">
110
166
 
111
167
  <div id="description">
112
- <p>
168
+ <hr size="1"></hr><p>
113
169
  Gathers utility methods.
114
170
  </p>
115
171
 
116
172
  </div>
117
173
 
118
-
119
174
  </div>
120
175
 
176
+
121
177
  <div id="method-list">
122
178
  <h3 class="section-bar">Methods</h3>
123
179
 
124
180
  <div class="name-list">
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;
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
+
134
200
  </div>
135
201
  </div>
136
202
 
137
203
  </div>
138
204
 
139
-
140
205
  <!-- if includes -->
141
206
 
142
207
  <div id="section">
@@ -157,74 +222,96 @@ Class <a href="SDL4R/Tag.html" class="link">SDL4R::Tag</a><br />
157
222
 
158
223
  <div class="name-list">
159
224
  <table summary="Constants">
225
+
160
226
  <tr class="top-aligned-row context-row">
161
227
  <td class="context-item-name">MAX_INTEGER_32</td>
162
228
  <td>=</td>
163
229
  <td class="context-item-value">2**31 - 1</td>
230
+
164
231
  </tr>
232
+
165
233
  <tr class="top-aligned-row context-row">
166
234
  <td class="context-item-name">MIN_INTEGER_32</td>
167
235
  <td>=</td>
168
236
  <td class="context-item-value">-(2**31)</td>
237
+
169
238
  </tr>
239
+
170
240
  <tr class="top-aligned-row context-row">
171
241
  <td class="context-item-name">MAX_INTEGER_64</td>
172
242
  <td>=</td>
173
243
  <td class="context-item-value">2**63 - 1</td>
244
+
174
245
  </tr>
246
+
175
247
  <tr class="top-aligned-row context-row">
176
248
  <td class="context-item-name">MIN_INTEGER_64</td>
177
249
  <td>=</td>
178
250
  <td class="context-item-value">-(2**63)</td>
251
+
179
252
  </tr>
253
+
180
254
  <tr class="top-aligned-row context-row">
181
255
  <td class="context-item-name">BASE64_WRAP_LINE_LENGTH</td>
182
256
  <td>=</td>
183
257
  <td class="context-item-value">72</td>
258
+
184
259
  </tr>
260
+
185
261
  <tr class="top-aligned-row context-row">
186
262
  <td class="context-item-name">ESCAPED_QUOTES</td>
187
263
  <td>=</td>
188
264
  <td class="context-item-value">{ &quot;\&quot;&quot; =&gt; &quot;\\\&quot;&quot;, &quot;'&quot; =&gt; &quot;\\'&quot;, &quot;`&quot; =&gt; &quot;\\`&quot;, }</td>
265
+
189
266
  </tr>
267
+
190
268
  <tr class="top-aligned-row context-row">
191
269
  <td class="context-item-name">ESCAPED_CHARS</td>
192
270
  <td>=</td>
193
271
  <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
+
194
273
  </tr>
274
+
195
275
  </table>
196
276
  </div>
197
277
  </div>
198
278
 
199
279
 
200
280
 
201
-
202
-
203
281
 
204
282
  <!-- if method_list -->
283
+
205
284
  <div id="methods">
285
+
206
286
  <h3 class="section-bar">Public Class methods</h3>
207
287
 
288
+
208
289
  <div id="method-M000001" class="method-detail">
209
290
  <a name="M000001"></a>
210
291
 
211
292
  <div class="method-heading">
293
+
212
294
  <a href="#M000001" class="method-signature">
295
+
213
296
  <span class="method-name">SdlBinary</span><span class="method-args">(o)</span>
297
+
214
298
  </a>
299
+
215
300
  </div>
216
-
301
+
217
302
  <div class="method-description">
303
+
218
304
  <p>
219
305
  Try to coerce &#8216;o&#8217; into a <a
220
306
  href="SDL4R.html#M000001">SdlBinary</a>. Raise an ArgumentError if it
221
307
  fails.
222
308
  </p>
309
+
223
310
  <p><a class="source-toggle" href="#"
224
311
  onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
225
312
  <div class="method-source-code" id="M000001-source">
226
313
  <pre>
227
- <span class="ruby-comment cmt"># File lib/sdl4r/sdl_binary.rb, line 69</span>
314
+ <span class="ruby-comment cmt"># File lib/sdl4r/sdl_binary.rb, line 72</span>
228
315
  <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-constant">SdlBinary</span>(<span class="ruby-identifier">o</span>)
229
316
  <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">SdlBinary</span>
230
317
  <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">o</span>
@@ -236,19 +323,26 @@ fails.
236
323
  <span class="ruby-keyword kw">end</span>
237
324
  </pre>
238
325
  </div>
326
+
239
327
  </div>
240
328
  </div>
241
329
 
330
+
242
331
  <div id="method-M000004" class="method-detail">
243
332
  <a name="M000004"></a>
244
333
 
245
334
  <div class="method-heading">
335
+
246
336
  <a href="#M000004" class="method-signature">
337
+
247
338
  <span class="method-name">coerce_or_fail</span><span class="method-args">(o)</span>
339
+
248
340
  </a>
341
+
249
342
  </div>
250
-
343
+
251
344
  <div class="method-description">
345
+
252
346
  <p>
253
347
  Coerce the type to a standard SDL type or raises an ArgumentError.
254
348
  </p>
@@ -261,11 +355,12 @@ href="SDL4R.html#M000001">SdlBinary</a>,
261
355
  <p>
262
356
  Rationals are turned into Floats using Rational#to_f.
263
357
  </p>
358
+
264
359
  <p><a class="source-toggle" href="#"
265
360
  onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
266
361
  <div class="method-source-code" id="M000004-source">
267
362
  <pre>
268
- <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 149</span>
363
+ <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 151</span>
269
364
  <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">coerce_or_fail</span>(<span class="ruby-identifier">o</span>)
270
365
  <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">o</span>
271
366
 
@@ -291,42 +386,50 @@ Rationals are turned into Floats using Rational#to_f.
291
386
  <span class="ruby-keyword kw">end</span>
292
387
  </pre>
293
388
  </div>
389
+
294
390
  </div>
295
391
  </div>
296
392
 
393
+
297
394
  <div id="method-M000002" class="method-detail">
298
395
  <a name="M000002"></a>
299
396
 
300
397
  <div class="method-heading">
398
+
301
399
  <a href="#M000002" class="method-signature">
400
+
302
401
  <span class="method-name">format</span><span class="method-args">(o, add_quotes = true, line_prefix = &quot;&quot;, indent = &quot;\t&quot;)</span>
402
+
303
403
  </a>
404
+
304
405
  </div>
305
-
406
+
306
407
  <div class="method-description">
408
+
307
409
  <p>
308
410
  Creates an SDL string representation for a given object and returns it.
309
411
  </p>
310
412
  <table>
311
- <tr><td valign="top"><tt>o</tt>:</td><td>the object to <a href="SDL4R.html#M000002">format</a>
413
+ <tr><td valign="top"><tt>o</tt>:</td><td>the object to format
312
414
 
313
415
  </td></tr>
314
416
  <tr><td valign="top"><tt>add_quotes</tt>:</td><td>indicates whether quotes will be added to Strings and characters (true by
315
417
  default)
316
418
 
317
419
  </td></tr>
318
- <tr><td valign="top"><tt>line_prefix</tt>:</td><td>the line prefix to use (&quot;&quot; by default)
420
+ <tr><td valign="top"><tt>line_prefix</tt>:</td><td>the line prefix to use (&#8220;&#8221; by default)
319
421
 
320
422
  </td></tr>
321
- <tr><td valign="top"><tt>indent</tt>:</td><td>the indent string to use (&quot;\t&quot; by default)
423
+ <tr><td valign="top"><tt>indent</tt>:</td><td>the indent string to use (&#8220;t&#8220; by default)
322
424
 
323
425
  </td></tr>
324
426
  </table>
427
+
325
428
  <p><a class="source-toggle" href="#"
326
429
  onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
327
430
  <div class="method-source-code" id="M000002-source">
328
431
  <pre>
329
- <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 42</span>
432
+ <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 44</span>
330
433
  <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">format</span>(<span class="ruby-identifier">o</span>, <span class="ruby-identifier">add_quotes</span> = <span class="ruby-keyword kw">true</span>, <span class="ruby-identifier">line_prefix</span> = <span class="ruby-value str">&quot;&quot;</span>, <span class="ruby-identifier">indent</span> = <span class="ruby-value str">&quot;\t&quot;</span>)
331
434
  <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
332
435
  <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">add_quotes</span>
@@ -388,7 +491,7 @@ default)
388
491
  <span class="ruby-comment cmt"># Below, we use &quot;#{o.year}&quot; instead of &quot;%Y&quot; because &quot;%Y&quot; always emit 4 chars at least even if</span>
389
492
  <span class="ruby-comment cmt"># the date is before 1000.</span>
390
493
  <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">DateTime</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Time</span>)
391
- <span class="ruby-identifier">milliseconds</span> = <span class="ruby-identifier">o</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">DateTime</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">get_date_milliseconds</span>(<span class="ruby-identifier">o</span>) <span class="ruby-operator">:</span> (<span class="ruby-identifier">o</span>.<span class="ruby-identifier">usec</span> <span class="ruby-operator">/</span> <span class="ruby-value">10</span>).<span class="ruby-identifier">to_i</span>
494
+ <span class="ruby-identifier">milliseconds</span> = <span class="ruby-identifier">get_datetime_milliseconds</span>(<span class="ruby-identifier">o</span>)
392
495
 
393
496
  <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">milliseconds</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
394
497
  <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">zone</span>
@@ -413,19 +516,26 @@ default)
413
516
  <span class="ruby-keyword kw">end</span>
414
517
  </pre>
415
518
  </div>
519
+
416
520
  </div>
417
521
  </div>
418
522
 
523
+
419
524
  <div id="method-M000003" class="method-detail">
420
525
  <a name="M000003"></a>
421
526
 
422
527
  <div class="method-heading">
528
+
423
529
  <a href="#M000003" class="method-signature">
530
+
424
531
  <span class="method-name">new_date_time</span><span class="method-args">(year, month, day, hour, min, sec, time_zone_offset)</span>
532
+
425
533
  </a>
534
+
426
535
  </div>
427
-
536
+
428
537
  <div class="method-description">
538
+
429
539
  <p>
430
540
  Creates and returns the object representing a datetime (DateTime in the
431
541
  default implementation). This method is, by default, called by the <a
@@ -440,31 +550,39 @@ parsers.
440
550
  end
441
551
  end
442
552
  </pre>
553
+
443
554
  <p><a class="source-toggle" href="#"
444
555
  onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
445
556
  <div class="method-source-code" id="M000003-source">
446
557
  <pre>
447
- <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 137</span>
558
+ <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 139</span>
448
559
  <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new_date_time</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">time_zone_offset</span>)
449
560
  <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">time_zone_offset</span>)
450
561
  <span class="ruby-keyword kw">end</span>
451
562
  </pre>
452
563
  </div>
564
+
453
565
  </div>
454
566
  </div>
455
567
 
568
+
456
569
  <div id="method-M000006" class="method-detail">
457
570
  <a name="M000006"></a>
458
571
 
459
572
  <div class="method-heading">
573
+
460
574
  <a href="#M000006" class="method-signature">
575
+
461
576
  <span class="method-name">read</span><span class="method-args">(input)</span>
577
+
462
578
  </a>
579
+
463
580
  </div>
464
-
581
+
465
582
  <div class="method-description">
583
+
466
584
  <p>
467
- Creates and returns a tag named &quot;root&quot; and add all the tags
585
+ Creates and returns a tag named &#8220;root&#8221; and add all the tags
468
586
  specified in the given <tt>input</tt>.
469
587
  </p>
470
588
  <table>
@@ -489,29 +607,37 @@ specified in the given <tt>input</tt>.
489
607
 
490
608
  root = SDL4R::read(URI.new(&quot;http://my_site/my_file.sdl&quot;))
491
609
  </pre>
610
+
492
611
  <p><a class="source-toggle" href="#"
493
612
  onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
494
613
  <div class="method-source-code" id="M000006-source">
495
614
  <pre>
496
- <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 230</span>
615
+ <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 232</span>
497
616
  <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">input</span>)
498
617
  <span class="ruby-constant">Tag</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;root&quot;</span>).<span class="ruby-identifier">read</span>(<span class="ruby-identifier">input</span>)
499
618
  <span class="ruby-keyword kw">end</span>
500
619
  </pre>
501
620
  </div>
621
+
502
622
  </div>
503
623
  </div>
504
624
 
625
+
505
626
  <div id="method-M000009" class="method-detail">
506
627
  <a name="M000009"></a>
507
628
 
508
629
  <div class="method-heading">
630
+
509
631
  <a href="#M000009" class="method-signature">
632
+
510
633
  <span class="method-name">to_attribute_map</span><span class="method-args">(s)</span>
634
+
511
635
  </a>
636
+
512
637
  </div>
513
-
638
+
514
639
  <div class="method-description">
640
+
515
641
  <p>
516
642
  Parse a string representing the attributes portion of an SDL tag and return
517
643
  the results as a map.
@@ -524,30 +650,38 @@ Example
524
650
 
525
651
  # { &quot;value&quot; =&gt; 1, &quot;debugging&quot; =&gt; true, &quot;time&quot; =&gt; SdlTimeSpan.new(12, 24, 01) }
526
652
  </pre>
653
+
527
654
  <p><a class="source-toggle" href="#"
528
655
  onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
529
656
  <div class="method-source-code" id="M000009-source">
530
657
  <pre>
531
- <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 268</span>
658
+ <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 270</span>
532
659
  <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_attribute_map</span>(<span class="ruby-identifier">s</span>)
533
660
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;'s' cannot be null&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">nil?</span>
534
661
  <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">read</span>(<span class="ruby-value str">&quot;atts &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">s</span>).<span class="ruby-identifier">child</span>.<span class="ruby-identifier">attributes</span>
535
662
  <span class="ruby-keyword kw">end</span>
536
663
  </pre>
537
664
  </div>
665
+
538
666
  </div>
539
667
  </div>
540
668
 
669
+
541
670
  <div id="method-M000007" class="method-detail">
542
671
  <a name="M000007"></a>
543
672
 
544
673
  <div class="method-heading">
674
+
545
675
  <a href="#M000007" class="method-signature">
676
+
546
677
  <span class="method-name">to_value</span><span class="method-args">(s)</span>
678
+
547
679
  </a>
680
+
548
681
  </div>
549
-
682
+
550
683
  <div class="method-description">
684
+
551
685
  <p>
552
686
  Parses and returns the value corresponding with the specified SDL literal.
553
687
  </p>
@@ -556,30 +690,38 @@ Parses and returns the value corresponding with the specified SDL literal.
556
690
  SDL4R.to_value(&quot;1&quot;) # =&gt; 1
557
691
  SDL4R.to_value(&quot;null&quot;) # =&gt; nil
558
692
  </pre>
693
+
559
694
  <p><a class="source-toggle" href="#"
560
695
  onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
561
696
  <div class="method-source-code" id="M000007-source">
562
697
  <pre>
563
- <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 240</span>
698
+ <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 242</span>
564
699
  <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_value</span>(<span class="ruby-identifier">s</span>)
565
700
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;'s' cannot be null&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">nil?</span>
566
701
  <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">read</span>(<span class="ruby-identifier">s</span>).<span class="ruby-identifier">child</span>.<span class="ruby-identifier">value</span>
567
702
  <span class="ruby-keyword kw">end</span>
568
703
  </pre>
569
704
  </div>
705
+
570
706
  </div>
571
707
  </div>
572
708
 
709
+
573
710
  <div id="method-M000008" class="method-detail">
574
711
  <a name="M000008"></a>
575
712
 
576
713
  <div class="method-heading">
714
+
577
715
  <a href="#M000008" class="method-signature">
716
+
578
717
  <span class="method-name">to_value_array</span><span class="method-args">(s)</span>
718
+
579
719
  </a>
720
+
580
721
  </div>
581
-
722
+
582
723
  <div class="method-description">
724
+
583
725
  <p>
584
726
  Parse the string of values and return a list. The string is handled as if
585
727
  it is the values portion of an SDL tag.
@@ -593,30 +735,38 @@ Example
593
735
  <p>
594
736
  Will return an int, a boolean, and a time span.
595
737
  </p>
738
+
596
739
  <p><a class="source-toggle" href="#"
597
740
  onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
598
741
  <div class="method-source-code" id="M000008-source">
599
742
  <pre>
600
- <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 254</span>
743
+ <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 256</span>
601
744
  <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_value_array</span>(<span class="ruby-identifier">s</span>)
602
745
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;'s' cannot be null&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">nil?</span>
603
746
  <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">read</span>(<span class="ruby-identifier">s</span>).<span class="ruby-identifier">child</span>.<span class="ruby-identifier">values</span>
604
747
  <span class="ruby-keyword kw">end</span>
605
748
  </pre>
606
749
  </div>
750
+
607
751
  </div>
608
752
  </div>
609
753
 
754
+
610
755
  <div id="method-M000005" class="method-detail">
611
756
  <a name="M000005"></a>
612
757
 
613
758
  <div class="method-heading">
759
+
614
760
  <a href="#M000005" class="method-signature">
761
+
615
762
  <span class="method-name">validate_identifier</span><span class="method-args">(identifier)</span>
763
+
616
764
  </a>
765
+
617
766
  </div>
618
-
767
+
619
768
  <div class="method-description">
769
+
620
770
  <p>
621
771
  Validates an SDL identifier String. SDL Identifiers must start with a
622
772
  Unicode letter or underscore (_) and contain only unicode letters, digits,
@@ -629,11 +779,12 @@ ArgumentError if the identifier is not legal
629
779
  <p>
630
780
  TODO: support UTF-8 identifiers
631
781
  </p>
782
+
632
783
  <p><a class="source-toggle" href="#"
633
784
  onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
634
785
  <div class="method-source-code" id="M000005-source">
635
786
  <pre>
636
- <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 182</span>
787
+ <span class="ruby-comment cmt"># File lib/sdl4r/sdl4r.rb, line 184</span>
637
788
  <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">validate_identifier</span>(<span class="ruby-identifier">identifier</span>)
638
789
  <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">identifier</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">identifier</span>.<span class="ruby-identifier">empty?</span>
639
790
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;SDL identifiers cannot be null or empty.&quot;</span>
@@ -663,19 +814,22 @@ TODO: support UTF-8 identifiers
663
814
  <span class="ruby-keyword kw">end</span>
664
815
  </pre>
665
816
  </div>
817
+
666
818
  </div>
667
819
  </div>
668
820
 
669
821
 
822
+
670
823
  </div>
671
824
 
672
825
 
673
- </div>
674
826
 
675
827
 
828
+ </div>
829
+
676
830
  <div id="validator-badges">
677
831
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
678
832
  </div>
679
833
 
680
834
  </body>
681
- </html>
835
+ </html>