sdl4r 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/CHANGELOG +14 -1
  2. data/README +4 -4
  3. data/Rakefile +15 -12
  4. data/TODO +11 -4
  5. data/lib/sdl4r/parser.rb +25 -33
  6. data/lib/sdl4r/parser/token.rb +1 -1
  7. data/lib/sdl4r/sdl4r.rb +50 -22
  8. data/lib/sdl4r/sdl_time_span.rb +2 -2
  9. data/lib/sdl4r/serializer.rb +152 -0
  10. data/lib/sdl4r/tag.rb +15 -1
  11. data/test/sdl4r/parser_test.rb +5 -0
  12. data/test/sdl4r/serializer_test.rb +78 -0
  13. data/test/sdl4r/tag_test.rb +20 -1
  14. metadata +52 -81
  15. data/doc/classes/SDL4R.html +0 -408
  16. data/doc/classes/SDL4R/Parser.html +0 -190
  17. data/doc/classes/SDL4R/ParserTest.html +0 -385
  18. data/doc/classes/SDL4R/SDL4RTest.html +0 -532
  19. data/doc/classes/SDL4R/SDLTest.html +0 -77
  20. data/doc/classes/SDL4R/SdlBinary.html +0 -188
  21. data/doc/classes/SDL4R/SdlParseError.html +0 -110
  22. data/doc/classes/SDL4R/SdlTimeSpan.html +0 -637
  23. data/doc/classes/SDL4R/Tag.html +0 -1249
  24. data/doc/classes/SDL4R/TagTest.html +0 -292
  25. data/doc/created.rid +0 -1
  26. data/doc/files/CHANGELOG.html +0 -200
  27. data/doc/files/LICENSE.html +0 -497
  28. data/doc/files/README.html +0 -406
  29. data/doc/files/lib/sdl4r/parser/reader_rb.html +0 -54
  30. data/doc/files/lib/sdl4r/parser/time_span_with_zone_rb.html +0 -54
  31. data/doc/files/lib/sdl4r/parser/token_rb.html +0 -54
  32. data/doc/files/lib/sdl4r/parser/tokenizer_rb.html +0 -54
  33. data/doc/files/lib/sdl4r/parser_rb.html +0 -62
  34. data/doc/files/lib/sdl4r/sdl4r_rb.html +0 -64
  35. data/doc/files/lib/sdl4r/sdl_binary_rb.html +0 -54
  36. data/doc/files/lib/sdl4r/sdl_parse_error_rb.html +0 -54
  37. data/doc/files/lib/sdl4r/sdl_time_span_rb.html +0 -54
  38. data/doc/files/lib/sdl4r/tag_rb.html +0 -64
  39. data/doc/files/lib/sdl4r_rb.html +0 -54
  40. data/doc/files/test/sdl4r/parser_test_rb.html +0 -64
  41. data/doc/files/test/sdl4r/sdl4r_test_rb.html +0 -67
  42. data/doc/files/test/sdl4r/sdl_test_rb.html +0 -64
  43. data/doc/files/test/sdl4r/tag_test_rb.html +0 -64
  44. data/doc/fr_class_index.html +0 -19
  45. data/doc/fr_file_index.html +0 -37
  46. data/doc/fr_method_index.html +0 -4711
  47. data/doc/index.html +0 -15
  48. data/doc/rdoc-style.css +0 -328
@@ -1,77 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
- <html lang='en'>
3
- <head>
4
- <title>: SDL4R::SDLTest [RDoc: Simple Declarative Language for Ruby]</title>
5
- <meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
6
- <link href='../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
7
- <script type='text/javascript'>
8
- //<![CDATA[
9
- function popupCode(url) {
10
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
11
- }
12
-
13
- function toggleCode(id) {
14
- var code = document.getElementById(id)
15
-
16
- code.style.display = code.style.display != 'block' ? 'block' : 'none'
17
- return true
18
- }
19
-
20
- // Make codeblocks hidden by default
21
- document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
22
- //]]>
23
- </script>
24
- </head>
25
- <body class='page'>
26
- <div class='class' id='wrapper'>
27
- <div class='header'>
28
- <h1 class='name'>
29
- <span class='type'>Class</span>
30
- SDL4R::SDLTest
31
- </h1>
32
- <ol class='paths'>
33
- <li>
34
- <a href="../../files/test/sdl4r/sdl_test_rb.html">test/sdl4r/sdl_test.rb</a>
35
- </li>
36
- </ol>
37
- <div class='parent'>
38
- Parent:
39
- <strong>Test::Unit::TestCase</strong>
40
- </div>
41
- </div>
42
- <div id='content'>
43
- <div id='text'>
44
- <div id='method-list'>
45
- <h2>Methods</h2>
46
- <h3>public instance</h3>
47
- <ol>
48
- <li><a href="#M000129">test_coerce_or_fail</a></li>
49
- </ol>
50
- </div>
51
- <div id='section'>
52
- <div id='methods'>
53
- <h2>Public instance methods</h2>
54
- <div class='method public-instance' id='method-M000129'>
55
- <a name='M000129'></a>
56
- <div class='synopsis'>
57
- <span class='name'>test_coerce_or_fail</span>
58
- <span class='arguments'>()</span>
59
- </div>
60
- <div class='source'>
61
- <a class='source-toggle' href='#' onclick="toggleCode('M000129-source'); return false">
62
- [show source]
63
- </a>
64
- <pre id='M000129-source'> <span class="ruby-comment cmt"># File test/sdl4r/sdl_test.rb, line 30</span>&#x000A;30: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_coerce_or_fail</span>&#x000A;31: <span class="ruby-comment cmt"># Most basic types are considered to be tested in other tests (like ParserTest)</span>&#x000A;32: <span class="ruby-identifier">tag</span> = <span class="ruby-constant">Tag</span>.<span class="ruby-identifier">new</span> <span class="ruby-value str">&quot;tag1&quot;</span>&#x000A;33: <span class="ruby-identifier">assert_raise</span> <span class="ruby-constant">ArgumentError</span> <span class="ruby-keyword kw">do</span> <span class="ruby-identifier">tag</span>.<span class="ruby-identifier">add_value</span>(<span class="ruby-constant">Object</span>.<span class="ruby-identifier">new</span>) <span class="ruby-keyword kw">end</span>&#x000A;34: <span class="ruby-identifier">assert_raise</span> <span class="ruby-constant">ArgumentError</span> <span class="ruby-keyword kw">do</span> <span class="ruby-identifier">tag</span>.<span class="ruby-identifier">add_value</span>([<span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>]) <span class="ruby-keyword kw">end</span>&#x000A;35: <span class="ruby-identifier">assert_raise</span> <span class="ruby-constant">ArgumentError</span> <span class="ruby-keyword kw">do</span> <span class="ruby-identifier">tag</span>.<span class="ruby-identifier">add_value</span>({<span class="ruby-value str">&quot;a&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;b&quot;</span>}) <span class="ruby-keyword kw">end</span>&#x000A;36: &#x000A;37: <span class="ruby-comment cmt"># check translation of Rational</span>&#x000A;38: <span class="ruby-identifier">tag</span>.<span class="ruby-identifier">add_value</span>(<span class="ruby-constant">Rational</span>(<span class="ruby-value">3</span>, <span class="ruby-value">10</span>))&#x000A;39: <span class="ruby-identifier">assert_equal</span> [<span class="ruby-value">0</span><span class="ruby-value">.3</span>], <span class="ruby-identifier">tag</span>.<span class="ruby-identifier">values</span>&#x000A;40: <span class="ruby-keyword kw">end</span></pre>
65
- </div>
66
- </div>
67
- </div>
68
- </div>
69
- </div>
70
- </div>
71
- <div id='footer-push'></div>
72
- </div>
73
- <div id='footer'>
74
- <a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
75
- </div>
76
- </body>
77
- </html>
@@ -1,188 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
- <html lang='en'>
3
- <head>
4
- <title>: SDL4R::SdlBinary [RDoc: Simple Declarative Language for Ruby]</title>
5
- <meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
6
- <link href='../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
7
- <script type='text/javascript'>
8
- //<![CDATA[
9
- function popupCode(url) {
10
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
11
- }
12
-
13
- function toggleCode(id) {
14
- var code = document.getElementById(id)
15
-
16
- code.style.display = code.style.display != 'block' ? 'block' : 'none'
17
- return true
18
- }
19
-
20
- // Make codeblocks hidden by default
21
- document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
22
- //]]>
23
- </script>
24
- </head>
25
- <body class='page'>
26
- <div class='class' id='wrapper'>
27
- <div class='header'>
28
- <h1 class='name'>
29
- <span class='type'>Class</span>
30
- SDL4R::SdlBinary
31
- </h1>
32
- <ol class='paths'>
33
- <li>
34
- <a href="../../files/lib/sdl4r/sdl_binary_rb.html">lib/sdl4r/sdl_binary.rb</a>
35
- </li>
36
- </ol>
37
- <div class='parent'>
38
- Parent:
39
- <strong>Object</strong>
40
- </div>
41
- </div>
42
- <div id='content'>
43
- <div id='text'>
44
- <div id='description'>
45
- <p>
46
- Represents a binary value.
47
- </p>
48
- <p>
49
- This class was introduced to avoid the confusion between a Ruby String and
50
- a binary literal.
51
- </p>
52
- </div>
53
- <div id='method-list'>
54
- <h2>Methods</h2>
55
- <h3>public class</h3>
56
- <ol>
57
- <li><a href="#M000089">decode64</a></li>
58
- <li><a href="#M000084">new</a></li>
59
- </ol>
60
- <h3>public instance</h3>
61
- <ol>
62
- <li><a href="#M000085">==</a></li>
63
- <li><a href="#M000086">eql?</a></li>
64
- <li><a href="#M000087">hash</a></li>
65
- <li><a href="#M000088">to_s</a></li>
66
- </ol>
67
- </div>
68
- <div id='section'>
69
- <div id='attribute-list'>
70
- <h2 class='section-bar'>Attributes</h2>
71
- <div class='name-list'>
72
- <table>
73
- <tr class='top-aligned-row context-row'>
74
- <td class='context-item-name'>bytes</td>
75
- <td class='context-item-value'>[RW]</td>
76
- <td class='context-item-desc'></td>
77
- </tr>
78
- </table>
79
- </div>
80
- </div>
81
- <div id='methods'>
82
- <h2>Public class methods</h2>
83
- <div class='method public-class' id='method-M000089'>
84
- <a name='M000089'></a>
85
- <div class='synopsis'>
86
- <span class='name'>decode64</span>
87
- <span class='arguments'>(s)</span>
88
- </div>
89
- <div class='description'>
90
- <p>
91
- Decodes the specified base-64 encoded string and returns a corresponding <a
92
- href="SdlBinary.html">SdlBinary</a> instance. <tt>s</tt> might not include
93
- the conventional starting and ending square brackets.
94
- </p>
95
- </div>
96
- <div class='source'>
97
- <a class='source-toggle' href='#' onclick="toggleCode('M000089-source'); return false">
98
- [show source]
99
- </a>
100
- <pre id='M000089-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_binary.rb, line 57</span>&#x000A;57: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">decode64</span>(<span class="ruby-identifier">s</span>)&#x000A;58: <span class="ruby-identifier">s</span> = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">&quot;\n\r\t &quot;</span>)&#x000A;59: &#x000A;60: <span class="ruby-identifier">binary</span> = <span class="ruby-constant">Base64</span>.<span class="ruby-identifier">decode64</span>(<span class="ruby-identifier">s</span>)&#x000A;61: &#x000A;62: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">binary</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">empty?</span>&#x000A;63: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;bad binary literal&quot;</span>&#x000A;64: <span class="ruby-keyword kw">end</span>&#x000A;65: &#x000A;66: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">SdlBinary</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">binary</span>)&#x000A;67: <span class="ruby-keyword kw">end</span></pre>
101
- </div>
102
- </div>
103
- <div class='method public-class' id='method-M000084'>
104
- <a name='M000084'></a>
105
- <div class='synopsis'>
106
- <span class='name'>new</span>
107
- <span class='arguments'>(bytes)</span>
108
- </div>
109
- <div class='description'>
110
- <p>
111
- <tt>value</tt>: a String containing the bytes
112
- </p>
113
- </div>
114
- <div class='source'>
115
- <a class='source-toggle' href='#' onclick="toggleCode('M000084-source'); return false">
116
- [show source]
117
- </a>
118
- <pre id='M000084-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_binary.rb, line 33</span>&#x000A;33: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">bytes</span>)&#x000A;34: <span class="ruby-ivar">@bytes</span> = <span class="ruby-identifier">bytes</span>&#x000A;35: <span class="ruby-keyword kw">end</span></pre>
119
- </div>
120
- </div>
121
- <h2>Public instance methods</h2>
122
- <div class='method public-instance' id='method-M000085'>
123
- <a name='M000085'></a>
124
- <div class='synopsis'>
125
- <span class='name'>==</span>
126
- <span class='arguments'>(o)</span>
127
- </div>
128
- <div class='source'>
129
- <a class='source-toggle' href='#' onclick="toggleCode('M000085-source'); return false">
130
- [show source]
131
- </a>
132
- <pre id='M000085-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_binary.rb, line 37</span>&#x000A;37: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">o</span>)&#x000A;38: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">equal?</span>(<span class="ruby-identifier">o</span>)&#x000A;39: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>)&#x000A;40: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bytes</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">bytes</span>&#x000A;41: <span class="ruby-keyword kw">end</span></pre>
133
- </div>
134
- </div>
135
- <div class='method public-instance' id='method-M000086'>
136
- <a name='M000086'></a>
137
- <div class='synopsis'>
138
- <span class='name'>eql?</span>
139
- <span class='arguments'>(o)</span>
140
- </div>
141
- <div class='description'>
142
- <p>
143
- Alias for #==
144
- </p>
145
- </div>
146
- </div>
147
- <div class='method public-instance' id='method-M000087'>
148
- <a name='M000087'></a>
149
- <div class='synopsis'>
150
- <span class='name'>hash</span>
151
- <span class='arguments'>()</span>
152
- </div>
153
- <div class='source'>
154
- <a class='source-toggle' href='#' onclick="toggleCode('M000087-source'); return false">
155
- [show source]
156
- </a>
157
- <pre id='M000087-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_binary.rb, line 45</span>&#x000A;45: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hash</span>&#x000A;46: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">bytes</span>.<span class="ruby-identifier">hash</span>&#x000A;47: <span class="ruby-keyword kw">end</span></pre>
158
- </div>
159
- </div>
160
- <div class='method public-instance' id='method-M000088'>
161
- <a name='M000088'></a>
162
- <div class='synopsis'>
163
- <span class='name'>to_s</span>
164
- <span class='arguments'>()</span>
165
- </div>
166
- <div class='description'>
167
- <p>
168
- Returns the bytes base64-encoded.
169
- </p>
170
- </div>
171
- <div class='source'>
172
- <a class='source-toggle' href='#' onclick="toggleCode('M000088-source'); return false">
173
- [show source]
174
- </a>
175
- <pre id='M000088-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_binary.rb, line 50</span>&#x000A;50: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>&#x000A;51: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Base64</span>.<span class="ruby-identifier">encode64</span>(<span class="ruby-identifier">bytes</span>)&#x000A;52: <span class="ruby-keyword kw">end</span></pre>
176
- </div>
177
- </div>
178
- </div>
179
- </div>
180
- </div>
181
- </div>
182
- <div id='footer-push'></div>
183
- </div>
184
- <div id='footer'>
185
- <a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
186
- </div>
187
- </body>
188
- </html>
@@ -1,110 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
- <html lang='en'>
3
- <head>
4
- <title>: SDL4R::SdlParseError [RDoc: Simple Declarative Language for Ruby]</title>
5
- <meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
6
- <link href='../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
7
- <script type='text/javascript'>
8
- //<![CDATA[
9
- function popupCode(url) {
10
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
11
- }
12
-
13
- function toggleCode(id) {
14
- var code = document.getElementById(id)
15
-
16
- code.style.display = code.style.display != 'block' ? 'block' : 'none'
17
- return true
18
- }
19
-
20
- // Make codeblocks hidden by default
21
- document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
22
- //]]>
23
- </script>
24
- </head>
25
- <body class='page'>
26
- <div class='class' id='wrapper'>
27
- <div class='header'>
28
- <h1 class='name'>
29
- <span class='type'>Class</span>
30
- SDL4R::SdlParseError
31
- </h1>
32
- <ol class='paths'>
33
- <li>
34
- <a href="../../files/lib/sdl4r/sdl_parse_error_rb.html">lib/sdl4r/sdl_parse_error.rb</a>
35
- </li>
36
- </ol>
37
- <div class='parent'>
38
- Parent:
39
- <strong>StandardError</strong>
40
- </div>
41
- </div>
42
- <div id='content'>
43
- <div id='text'>
44
- <div id='description'>
45
- <p>
46
- An exception describing a problem with an SDL document&#8217;s structure
47
- </p>
48
- </div>
49
- <div id='method-list'>
50
- <h2>Methods</h2>
51
- <h3>public class</h3>
52
- <ol>
53
- <li><a href="#M000037">new</a></li>
54
- </ol>
55
- </div>
56
- <div id='section'>
57
- <div id='attribute-list'>
58
- <h2 class='section-bar'>Attributes</h2>
59
- <div class='name-list'>
60
- <table>
61
- <tr class='top-aligned-row context-row'>
62
- <td class='context-item-name'>line</td>
63
- <td class='context-item-value'>[R]</td>
64
- <td class='context-item-desc'></td>
65
- </tr>
66
- <tr class='top-aligned-row context-row'>
67
- <td class='context-item-name'>position</td>
68
- <td class='context-item-value'>[R]</td>
69
- <td class='context-item-desc'></td>
70
- </tr>
71
- </table>
72
- </div>
73
- </div>
74
- <div id='methods'>
75
- <h2>Public class methods</h2>
76
- <div class='method public-class' id='method-M000037'>
77
- <a name='M000037'></a>
78
- <div class='synopsis'>
79
- <span class='name'>new</span>
80
- <span class='arguments'>(description, line_no, position, line = nil)</span>
81
- </div>
82
- <div class='description'>
83
- <p>
84
- Note: Line and positioning numbering start with 1 rather than 0 to be
85
- consistent with most editors.
86
- </p>
87
- <p>
88
- <tt>description</tt> A description of the problem. <tt>lineNo</tt> The line
89
- on which the error occured or -1 for unknown <tt>position</tt> The position
90
- (within the line) where the error occured or -1 for unknown
91
- </p>
92
- </div>
93
- <div class='source'>
94
- <a class='source-toggle' href='#' onclick="toggleCode('M000037-source'); return false">
95
- [show source]
96
- </a>
97
- <pre id='M000037-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_parse_error.rb, line 36</span>&#x000A;36: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">description</span>, <span class="ruby-identifier">line_no</span>, <span class="ruby-identifier">position</span>, <span class="ruby-identifier">line</span> = <span class="ruby-keyword kw">nil</span>)&#x000A;37: <span class="ruby-keyword kw">super</span>(&#x000A;38: <span class="ruby-node">&quot;#{description} Line &quot;</span> <span class="ruby-operator">+</span> ((<span class="ruby-identifier">line_no</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">line_no</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span>)<span class="ruby-operator">?</span> <span class="ruby-value str">&quot;unknown&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">line_no</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-operator">+</span>&#x000A;39: <span class="ruby-value str">&quot;, Position &quot;</span> <span class="ruby-operator">+</span> ((<span class="ruby-identifier">position</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">position</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span>)<span class="ruby-operator">?</span> <span class="ruby-value str">&quot;unknown&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">position</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-operator">+</span> <span class="ruby-identifier">$/</span> <span class="ruby-operator">+</span>&#x000A;40: ((<span class="ruby-identifier">line</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">position</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">0</span>)<span class="ruby-operator">?</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">position</span> <span class="ruby-value">? </span><span class="ruby-value str">&quot; &quot;</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">position</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>) <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;&quot;</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;^&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;&quot;</span>))&#x000A;41: &#x000A;42: <span class="ruby-ivar">@line</span> = <span class="ruby-identifier">line_no</span>&#x000A;43: <span class="ruby-ivar">@position</span> = <span class="ruby-identifier">position</span>&#x000A;44: <span class="ruby-keyword kw">end</span></pre>
98
- </div>
99
- </div>
100
- </div>
101
- </div>
102
- </div>
103
- </div>
104
- <div id='footer-push'></div>
105
- </div>
106
- <div id='footer'>
107
- <a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
108
- </div>
109
- </body>
110
- </html>
@@ -1,637 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
- <html lang='en'>
3
- <head>
4
- <title>: SDL4R::SdlTimeSpan [RDoc: Simple Declarative Language for Ruby]</title>
5
- <meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
6
- <link href='../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
7
- <script type='text/javascript'>
8
- //<![CDATA[
9
- function popupCode(url) {
10
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
11
- }
12
-
13
- function toggleCode(id) {
14
- var code = document.getElementById(id)
15
-
16
- code.style.display = code.style.display != 'block' ? 'block' : 'none'
17
- return true
18
- }
19
-
20
- // Make codeblocks hidden by default
21
- document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
22
- //]]>
23
- </script>
24
- </head>
25
- <body class='page'>
26
- <div class='class' id='wrapper'>
27
- <div class='header'>
28
- <h1 class='name'>
29
- <span class='type'>Class</span>
30
- SDL4R::SdlTimeSpan
31
- </h1>
32
- <ol class='paths'>
33
- <li>
34
- <a href="../../files/lib/sdl4r/sdl_time_span_rb.html">lib/sdl4r/sdl_time_span.rb</a>
35
- </li>
36
- </ol>
37
- <div class='parent'>
38
- Parent:
39
- <strong>Object</strong>
40
- </div>
41
- </div>
42
- <div id='content'>
43
- <div id='text'>
44
- <div id='description'>
45
- <p>
46
- Represents a period of time (duration) as opposed to a particular moment in
47
- time (which would be represented using a Date, DateTime or Time instance).
48
- </p>
49
- </div>
50
- <div id='method-list'>
51
- <h2>Methods</h2>
52
- <h3>public class</h3>
53
- <ol>
54
- <li><a href="#M000010">new</a></li>
55
- </ol>
56
- <h3>public instance</h3>
57
- <ol>
58
- <li><a href="#M000035">&lt;=&gt;</a></li>
59
- <li><a href="#M000034">==</a></li>
60
- <li><a href="#M000013">day</a></li>
61
- <li><a href="#M000012">days</a></li>
62
- <li><a href="#M000033">eql?</a></li>
63
- <li><a href="#M000032">hash</a></li>
64
- <li><a href="#M000015">hour</a></li>
65
- <li><a href="#M000014">hours</a></li>
66
- <li><a href="#M000020">milliseconds</a></li>
67
- <li><a href="#M000017">min</a></li>
68
- <li><a href="#M000016">minutes</a></li>
69
- <li><a href="#M000026">negate</a></li>
70
- <li><a href="#M000027">roll_days</a></li>
71
- <li><a href="#M000028">roll_hours</a></li>
72
- <li><a href="#M000031">roll_milliseconds</a></li>
73
- <li><a href="#M000029">roll_minutes</a></li>
74
- <li><a href="#M000030">roll_seconds</a></li>
75
- <li><a href="#M000019">sec</a></li>
76
- <li><a href="#M000018">seconds</a></li>
77
- <li><a href="#M000011">sign</a></li>
78
- <li><a href="#M000036">to_s</a></li>
79
- <li><a href="#M000022">total_hours</a></li>
80
- <li><a href="#M000025">total_milliseconds</a></li>
81
- <li><a href="#M000023">total_minutes</a></li>
82
- <li><a href="#M000024">total_seconds</a></li>
83
- <li><a href="#M000021">usec</a></li>
84
- </ol>
85
- </div>
86
- <div id='context'>
87
- <div id='includes'>
88
- <h2>Included modules</h2>
89
- <ol>
90
- <li>Comparable</li>
91
- </ol>
92
- </div>
93
- </div>
94
- <div id='section'>
95
- <div id='constants-list'>
96
- <h2>Constants</h2>
97
- <div class='name-list'>
98
- <table summary='Constants'>
99
- <tr class='top-aligned-row context-row'>
100
- <td class='context-item-name'>MILLISECONDS_IN_SECOND</td>
101
- <td>=</td>
102
- <td class='context-item-value'>1000</td>
103
- </tr>
104
- <tr class='top-aligned-row context-row'>
105
- <td class='context-item-name'>MILLISECONDS_IN_MINUTE</td>
106
- <td>=</td>
107
- <td class='context-item-value'>60 * MILLISECONDS_IN_SECOND</td>
108
- </tr>
109
- <tr class='top-aligned-row context-row'>
110
- <td class='context-item-name'>MILLISECONDS_IN_HOUR</td>
111
- <td>=</td>
112
- <td class='context-item-value'>60 * MILLISECONDS_IN_MINUTE</td>
113
- </tr>
114
- <tr class='top-aligned-row context-row'>
115
- <td class='context-item-name'>MILLISECONDS_IN_DAY</td>
116
- <td>=</td>
117
- <td class='context-item-value'>24 * MILLISECONDS_IN_HOUR</td>
118
- </tr>
119
- </table>
120
- </div>
121
- </div>
122
- <div id='methods'>
123
- <h2>Public class methods</h2>
124
- <div class='method public-class' id='method-M000010'>
125
- <a name='M000010'></a>
126
- <div class='synopsis'>
127
- <span class='name'>new</span>
128
- <span class='arguments'>(*args)</span>
129
- </div>
130
- <div class='description'>
131
- <p>
132
- Create an <a href="SdlTimeSpan.html">SdlTimeSpan</a>. Note: if the timespan
133
- is negative all components should be negative.
134
- </p>
135
- <pre>SdlTimeSpan.new(days, hours, minutes, seconds = 0, milliseconds = 0)</pre>
136
- <p>
137
- or
138
- </p>
139
- <pre>SdlTimeSpan.new(totalMilliseconds)</pre>
140
- </div>
141
- <div class='source'>
142
- <a class='source-toggle' href='#' onclick="toggleCode('M000010-source'); return false">
143
- [show source]
144
- </a>
145
- <pre id='M000010-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_time_span.rb, line 76</span>&#x000A;76: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)&#x000A;77: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>&#x000A;78: <span class="ruby-identifier">initialize_total_milliseconds</span>(<span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>])&#x000A;79: <span class="ruby-keyword kw">else</span>&#x000A;80: <span class="ruby-identifier">initialize_days_hours_minutes</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)&#x000A;81: <span class="ruby-keyword kw">end</span>&#x000A;82: <span class="ruby-keyword kw">end</span></pre>
146
- </div>
147
- </div>
148
- <h2>Public instance methods</h2>
149
- <div class='method public-instance' id='method-M000035'>
150
- <a name='M000035'></a>
151
- <div class='synopsis'>
152
- <span class='name'>&lt;=&gt;</span>
153
- <span class='arguments'>(other)</span>
154
- </div>
155
- <div class='source'>
156
- <a class='source-toggle' href='#' onclick="toggleCode('M000035-source'); return false">
157
- [show source]
158
- </a>
159
- <pre id='M000035-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_time_span.rb, line 229</span>&#x000A;229: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;=&gt;</span>(<span class="ruby-identifier">other</span>)&#x000A;230: <span class="ruby-ivar">@totalMilliseconds</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">total_milliseconds</span>&#x000A;231: <span class="ruby-keyword kw">end</span></pre>
160
- </div>
161
- </div>
162
- <div class='method public-instance' id='method-M000034'>
163
- <a name='M000034'></a>
164
- <div class='synopsis'>
165
- <span class='name'>==</span>
166
- <span class='arguments'>(other)</span>
167
- </div>
168
- <div class='description'>
169
- <p>
170
- Alias for <a href="SdlTimeSpan.html#M000033">eql?</a>
171
- </p>
172
- </div>
173
- </div>
174
- <div class='method public-instance' id='method-M000013'>
175
- <a name='M000013'></a>
176
- <div class='synopsis'>
177
- <span class='name'>day</span>
178
- <span class='arguments'>()</span>
179
- </div>
180
- <div class='description'>
181
- <p>
182
- Alias for <a href="SdlTimeSpan.html#M000012">days</a>
183
- </p>
184
- </div>
185
- </div>
186
- <div class='method public-instance' id='method-M000012'>
187
- <a name='M000012'></a>
188
- <div class='synopsis'>
189
- <span class='name'>days</span>
190
- <span class='arguments'>()</span>
191
- </div>
192
- <div class='description'>
193
- <p>
194
- The days component.
195
- </p>
196
- </div>
197
- <div class='source'>
198
- <a class='source-toggle' href='#' onclick="toggleCode('M000012-source'); return false">
199
- [show source]
200
- </a>
201
- <pre id='M000012-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_time_span.rb, line 92</span>&#x000A;92: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">days</span>&#x000A;93: <span class="ruby-identifier">sign</span> <span class="ruby-operator">*</span> (<span class="ruby-ivar">@totalMilliseconds</span>.<span class="ruby-identifier">abs</span> <span class="ruby-operator">/</span> <span class="ruby-constant">MILLISECONDS_IN_DAY</span>)&#x000A;94: <span class="ruby-keyword kw">end</span></pre>
202
- </div>
203
- </div>
204
- <div class='method public-instance' id='method-M000033'>
205
- <a name='M000033'></a>
206
- <div class='synopsis'>
207
- <span class='name'>eql?</span>
208
- <span class='arguments'>(other)</span>
209
- </div>
210
- <div class='description'>
211
- <p>
212
- Tests for equivalence.
213
- </p>
214
- </div>
215
- <div class='source'>
216
- <a class='source-toggle' href='#' onclick="toggleCode('M000033-source'); return false">
217
- [show source]
218
- </a>
219
- <pre id='M000033-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_time_span.rb, line 222</span>&#x000A;222: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">eql?</span>(<span class="ruby-identifier">other</span>)&#x000A;223: <span class="ruby-identifier">other</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">SdlTimeSpan</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@totalMilliseconds</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">total_milliseconds</span>&#x000A;224: <span class="ruby-keyword kw">end</span></pre>
220
- </div>
221
- </div>
222
- <div class='method public-instance' id='method-M000032'>
223
- <a name='M000032'></a>
224
- <div class='synopsis'>
225
- <span class='name'>hash</span>
226
- <span class='arguments'>()</span>
227
- </div>
228
- <div class='description'>
229
- <p>
230
- A hashcode based on the canonical string representation.
231
- </p>
232
- </div>
233
- <div class='source'>
234
- <a class='source-toggle' href='#' onclick="toggleCode('M000032-source'); return false">
235
- [show source]
236
- </a>
237
- <pre id='M000032-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_time_span.rb, line 216</span>&#x000A;216: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hash</span>&#x000A;217: <span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">hash</span>&#x000A;218: <span class="ruby-keyword kw">end</span></pre>
238
- </div>
239
- </div>
240
- <div class='method public-instance' id='method-M000015'>
241
- <a name='M000015'></a>
242
- <div class='synopsis'>
243
- <span class='name'>hour</span>
244
- <span class='arguments'>()</span>
245
- </div>
246
- <div class='description'>
247
- <p>
248
- Alias for <a href="SdlTimeSpan.html#M000014">hours</a>
249
- </p>
250
- </div>
251
- </div>
252
- <div class='method public-instance' id='method-M000014'>
253
- <a name='M000014'></a>
254
- <div class='synopsis'>
255
- <span class='name'>hours</span>
256
- <span class='arguments'>()</span>
257
- </div>
258
- <div class='description'>
259
- <p>
260
- The hours component.
261
- </p>
262
- </div>
263
- <div class='source'>
264
- <a class='source-toggle' href='#' onclick="toggleCode('M000014-source'); return false">
265
- [show source]
266
- </a>
267
- <pre id='M000014-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_time_span.rb, line 99</span>&#x000A; 99: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hours</span>&#x000A;100: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sign</span> <span class="ruby-operator">*</span> ((<span class="ruby-ivar">@totalMilliseconds</span> <span class="ruby-operator">-</span> (<span class="ruby-identifier">days</span> <span class="ruby-operator">*</span> <span class="ruby-constant">MILLISECONDS_IN_DAY</span>)).<span class="ruby-identifier">abs</span> <span class="ruby-operator">/</span> <span class="ruby-constant">MILLISECONDS_IN_HOUR</span>)&#x000A;101: <span class="ruby-keyword kw">end</span></pre>
268
- </div>
269
- </div>
270
- <div class='method public-instance' id='method-M000020'>
271
- <a name='M000020'></a>
272
- <div class='synopsis'>
273
- <span class='name'>milliseconds</span>
274
- <span class='arguments'>()</span>
275
- </div>
276
- <div class='description'>
277
- <p>
278
- The milliseconds component.
279
- </p>
280
- </div>
281
- <div class='source'>
282
- <a class='source-toggle' href='#' onclick="toggleCode('M000020-source'); return false">
283
- [show source]
284
- </a>
285
- <pre id='M000020-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_time_span.rb, line 125</span>&#x000A;125: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">milliseconds</span>&#x000A;126: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@totalMilliseconds</span> <span class="ruby-operator">-</span>&#x000A;127: (<span class="ruby-identifier">days</span> <span class="ruby-operator">*</span> <span class="ruby-constant">MILLISECONDS_IN_DAY</span>) <span class="ruby-operator">-</span>&#x000A;128: (<span class="ruby-identifier">hours</span> <span class="ruby-operator">*</span> <span class="ruby-constant">MILLISECONDS_IN_HOUR</span>) <span class="ruby-operator">-</span>&#x000A;129: (<span class="ruby-identifier">minutes</span> <span class="ruby-operator">*</span> <span class="ruby-constant">MILLISECONDS_IN_MINUTE</span>) <span class="ruby-operator">-</span>&#x000A;130: (<span class="ruby-identifier">seconds</span> <span class="ruby-operator">*</span> <span class="ruby-constant">MILLISECONDS_IN_SECOND</span>)&#x000A;131: <span class="ruby-keyword kw">end</span></pre>
286
- </div>
287
- </div>
288
- <div class='method public-instance' id='method-M000017'>
289
- <a name='M000017'></a>
290
- <div class='synopsis'>
291
- <span class='name'>min</span>
292
- <span class='arguments'>()</span>
293
- </div>
294
- <div class='description'>
295
- <p>
296
- Alias for <a href="SdlTimeSpan.html#M000016">minutes</a>
297
- </p>
298
- </div>
299
- </div>
300
- <div class='method public-instance' id='method-M000016'>
301
- <a name='M000016'></a>
302
- <div class='synopsis'>
303
- <span class='name'>minutes</span>
304
- <span class='arguments'>()</span>
305
- </div>
306
- <div class='description'>
307
- <p>
308
- The minutes component.
309
- </p>
310
- </div>
311
- <div class='source'>
312
- <a class='source-toggle' href='#' onclick="toggleCode('M000016-source'); return false">
313
- [show source]
314
- </a>
315
- <pre id='M000016-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_time_span.rb, line 106</span>&#x000A;106: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">minutes</span>&#x000A;107: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sign</span> <span class="ruby-operator">*</span>&#x000A;108: ((<span class="ruby-ivar">@totalMilliseconds</span> <span class="ruby-operator">-</span> (<span class="ruby-identifier">days</span> <span class="ruby-operator">*</span> <span class="ruby-constant">MILLISECONDS_IN_DAY</span>) <span class="ruby-operator">-</span> (<span class="ruby-identifier">hours</span> <span class="ruby-operator">*</span> <span class="ruby-constant">MILLISECONDS_IN_HOUR</span>)).<span class="ruby-identifier">abs</span> <span class="ruby-operator">/</span>&#x000A;109: <span class="ruby-constant">MILLISECONDS_IN_MINUTE</span>)&#x000A;110: <span class="ruby-keyword kw">end</span></pre>
316
- </div>
317
- </div>
318
- <div class='method public-instance' id='method-M000026'>
319
- <a name='M000026'></a>
320
- <div class='synopsis'>
321
- <span class='name'>negate</span>
322
- <span class='arguments'>()</span>
323
- </div>
324
- <div class='description'>
325
- <p>
326
- Returns an new <a href="SdlTimeSpan.html">SdlTimeSpan</a> instance that is
327
- the opposite of this instance
328
- </p>
329
- </div>
330
- <div class='source'>
331
- <a class='source-toggle' href='#' onclick="toggleCode('M000026-source'); return false">
332
- [show source]
333
- </a>
334
- <pre id='M000026-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_time_span.rb, line 165</span>&#x000A;165: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">negate</span>&#x000A;166: <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">-</span><span class="ruby-ivar">@totalMilliseconds</span>)&#x000A;167: <span class="ruby-keyword kw">end</span></pre>
335
- </div>
336
- </div>
337
- <div class='method public-instance' id='method-M000027'>
338
- <a name='M000027'></a>
339
- <div class='synopsis'>
340
- <span class='name'>roll_days</span>
341
- <span class='arguments'>(days)</span>
342
- </div>
343
- <div class='description'>
344
- <p>
345
- Return a new instance with the days adjusted by the given amount. Positive
346
- numbers add days. Negative numbers remove days.
347
- </p>
348
- <table>
349
- <tr><td valign="top"><tt>days</tt>:</td><td>The adjustment (days to add or subtract)
350
-
351
- </td></tr>
352
- </table>
353
- </div>
354
- <div class='source'>
355
- <a class='source-toggle' href='#' onclick="toggleCode('M000027-source'); return false">
356
- [show source]
357
- </a>
358
- <pre id='M000027-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_time_span.rb, line 174</span>&#x000A;174: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">roll_days</span>(<span class="ruby-identifier">days</span>)&#x000A;175: <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@totalMilliseconds</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">days</span> <span class="ruby-operator">*</span> <span class="ruby-constant">MILLISECONDS_IN_DAY</span>))&#x000A;176: <span class="ruby-keyword kw">end</span></pre>
359
- </div>
360
- </div>
361
- <div class='method public-instance' id='method-M000028'>
362
- <a name='M000028'></a>
363
- <div class='synopsis'>
364
- <span class='name'>roll_hours</span>
365
- <span class='arguments'>(hours)</span>
366
- </div>
367
- <div class='description'>
368
- <p>
369
- Return a new instance with the hours adjusted by the given amount. Positive
370
- numbers add hours. Negative numbers remove hours.
371
- </p>
372
- <table>
373
- <tr><td valign="top"><tt>hours</tt>:</td><td>The adjustment (hours to add or subtract)
374
-
375
- </td></tr>
376
- </table>
377
- </div>
378
- <div class='source'>
379
- <a class='source-toggle' href='#' onclick="toggleCode('M000028-source'); return false">
380
- [show source]
381
- </a>
382
- <pre id='M000028-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_time_span.rb, line 183</span>&#x000A;183: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">roll_hours</span>(<span class="ruby-identifier">hours</span>)&#x000A;184: <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@totalMilliseconds</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">hours</span> <span class="ruby-operator">*</span> <span class="ruby-constant">MILLISECONDS_IN_HOUR</span>))&#x000A;185: <span class="ruby-keyword kw">end</span></pre>
383
- </div>
384
- </div>
385
- <div class='method public-instance' id='method-M000031'>
386
- <a name='M000031'></a>
387
- <div class='synopsis'>
388
- <span class='name'>roll_milliseconds</span>
389
- <span class='arguments'>(milliseconds)</span>
390
- </div>
391
- <div class='description'>
392
- <p>
393
- Return a new instance with the milliseconds adjusted by the given amount.
394
- Positive numbers add milliseconds. Negative numbers remove milliseconds.
395
- </p>
396
- <table>
397
- <tr><td valign="top"><tt>milliseconds</tt>:</td><td>The adjustment (milliseconds to add or subtract)
398
-
399
- </td></tr>
400
- </table>
401
- </div>
402
- <div class='source'>
403
- <a class='source-toggle' href='#' onclick="toggleCode('M000031-source'); return false">
404
- [show source]
405
- </a>
406
- <pre id='M000031-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_time_span.rb, line 210</span>&#x000A;210: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">roll_milliseconds</span>(<span class="ruby-identifier">milliseconds</span>)&#x000A;211: <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@totalMilliseconds</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">milliseconds</span>)&#x000A;212: <span class="ruby-keyword kw">end</span></pre>
407
- </div>
408
- </div>
409
- <div class='method public-instance' id='method-M000029'>
410
- <a name='M000029'></a>
411
- <div class='synopsis'>
412
- <span class='name'>roll_minutes</span>
413
- <span class='arguments'>(minutes)</span>
414
- </div>
415
- <div class='description'>
416
- <p>
417
- Return a new instance with the minutes adjusted by the given amount.
418
- Positive numbers add minutes. Negative numbers remove minutes.
419
- </p>
420
- <table>
421
- <tr><td valign="top"><tt>minutes</tt>:</td><td>The adjustment (minutes to add or subtract)
422
-
423
- </td></tr>
424
- </table>
425
- </div>
426
- <div class='source'>
427
- <a class='source-toggle' href='#' onclick="toggleCode('M000029-source'); return false">
428
- [show source]
429
- </a>
430
- <pre id='M000029-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_time_span.rb, line 192</span>&#x000A;192: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">roll_minutes</span>(<span class="ruby-identifier">minutes</span>)&#x000A;193: <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@totalMilliseconds</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">minutes</span> <span class="ruby-operator">*</span> <span class="ruby-constant">MILLISECONDS_IN_MINUTE</span>))&#x000A;194: <span class="ruby-keyword kw">end</span></pre>
431
- </div>
432
- </div>
433
- <div class='method public-instance' id='method-M000030'>
434
- <a name='M000030'></a>
435
- <div class='synopsis'>
436
- <span class='name'>roll_seconds</span>
437
- <span class='arguments'>(seconds)</span>
438
- </div>
439
- <div class='description'>
440
- <p>
441
- Return a new instance with the seconds adjusted by the given amount.
442
- Positive numbers add seconds. Negative numbers remove seconds.
443
- </p>
444
- <table>
445
- <tr><td valign="top"><tt>seconds</tt>:</td><td>The adjustment (seconds to add or subtract)
446
-
447
- </td></tr>
448
- </table>
449
- </div>
450
- <div class='source'>
451
- <a class='source-toggle' href='#' onclick="toggleCode('M000030-source'); return false">
452
- [show source]
453
- </a>
454
- <pre id='M000030-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_time_span.rb, line 201</span>&#x000A;201: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">roll_seconds</span>(<span class="ruby-identifier">seconds</span>)&#x000A;202: <span class="ruby-constant">SdlTimeSpan</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@totalMilliseconds</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">seconds</span> <span class="ruby-operator">*</span> <span class="ruby-constant">MILLISECONDS_IN_SECOND</span>))&#x000A;203: <span class="ruby-keyword kw">end</span></pre>
455
- </div>
456
- </div>
457
- <div class='method public-instance' id='method-M000019'>
458
- <a name='M000019'></a>
459
- <div class='synopsis'>
460
- <span class='name'>sec</span>
461
- <span class='arguments'>()</span>
462
- </div>
463
- <div class='description'>
464
- <p>
465
- Alias for <a href="SdlTimeSpan.html#M000018">seconds</a>
466
- </p>
467
- </div>
468
- </div>
469
- <div class='method public-instance' id='method-M000018'>
470
- <a name='M000018'></a>
471
- <div class='synopsis'>
472
- <span class='name'>seconds</span>
473
- <span class='arguments'>()</span>
474
- </div>
475
- <div class='description'>
476
- <p>
477
- The seconds component.
478
- </p>
479
- </div>
480
- <div class='source'>
481
- <a class='source-toggle' href='#' onclick="toggleCode('M000018-source'); return false">
482
- [show source]
483
- </a>
484
- <pre id='M000018-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_time_span.rb, line 115</span>&#x000A;115: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">seconds</span>&#x000A;116: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sign</span> <span class="ruby-operator">*</span>&#x000A;117: ((<span class="ruby-ivar">@totalMilliseconds</span> <span class="ruby-operator">-</span> (<span class="ruby-identifier">days</span> <span class="ruby-operator">*</span> <span class="ruby-constant">MILLISECONDS_IN_DAY</span>) <span class="ruby-operator">-</span> (<span class="ruby-identifier">hours</span> <span class="ruby-operator">*</span> <span class="ruby-constant">MILLISECONDS_IN_HOUR</span>) <span class="ruby-operator">-</span>&#x000A;118: (<span class="ruby-identifier">minutes</span> <span class="ruby-operator">*</span> <span class="ruby-constant">MILLISECONDS_IN_MINUTE</span>)).<span class="ruby-identifier">abs</span> <span class="ruby-operator">/</span>&#x000A;119: <span class="ruby-constant">MILLISECONDS_IN_SECOND</span>)&#x000A;120: <span class="ruby-keyword kw">end</span></pre>
485
- </div>
486
- </div>
487
- <div class='method public-instance' id='method-M000011'>
488
- <a name='M000011'></a>
489
- <div class='synopsis'>
490
- <span class='name'>sign</span>
491
- <span class='arguments'>()</span>
492
- </div>
493
- <div class='description'>
494
- <p>
495
- Returns the sign (-1 or +1) of this <a
496
- href="SdlTimeSpan.html">SdlTimeSpan</a>.
497
- </p>
498
- </div>
499
- <div class='source'>
500
- <a class='source-toggle' href='#' onclick="toggleCode('M000011-source'); return false">
501
- [show source]
502
- </a>
503
- <pre id='M000011-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_time_span.rb, line 86</span>&#x000A;86: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sign</span>&#x000A;87: <span class="ruby-ivar">@totalMilliseconds</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-value">0</span>&#x000A;88: <span class="ruby-keyword kw">end</span></pre>
504
- </div>
505
- </div>
506
- <div class='method public-instance' id='method-M000036'>
507
- <a name='M000036'></a>
508
- <div class='synopsis'>
509
- <span class='name'>to_s</span>
510
- <span class='arguments'>()</span>
511
- </div>
512
- <div class='description'>
513
- <p>
514
- Returns an SDL representation of this time span using the format:
515
- </p>
516
- <pre>(days:)hours:minutes:seconds(.milliseconds)</pre>
517
- <p>
518
- (parenthesis indicate optional components)
519
- </p>
520
- <p>
521
- The days and milliseconds components will not be included if they are set
522
- to 0. Days must be suffixed with &#8220;d&#8221; for clarity.
523
- </p>
524
- <p>
525
- Hours, minutes, and seconds will be zero paded to two characters.
526
- </p>
527
- <p>
528
- Examples:
529
- </p>
530
- <pre>23:13:00 (12 hours and 13 minutes)&#x000A;24d:12:13:09.234 (24 days, 12 hours, 13 minutes, 9 seconds,&#x000A; 234 milliseconds)</pre>
531
- </div>
532
- <div class='source'>
533
- <a class='source-toggle' href='#' onclick="toggleCode('M000036-source'); return false">
534
- [show source]
535
- </a>
536
- <pre id='M000036-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_time_span.rb, line 250</span>&#x000A;250: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>&#x000A;251: <span class="ruby-identifier">_days</span> = <span class="ruby-identifier">days</span>&#x000A;252: <span class="ruby-identifier">_milliseconds</span> = <span class="ruby-identifier">milliseconds</span>&#x000A;253: &#x000A;254: <span class="ruby-identifier">s</span> = <span class="ruby-keyword kw">nil</span>&#x000A;255: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">_days</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>&#x000A;256: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">_milliseconds</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>&#x000A;257: <span class="ruby-identifier">s</span> = <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">&quot;%d:%02d:%02d&quot;</span>, <span class="ruby-identifier">hours</span>, <span class="ruby-identifier">minutes</span>.<span class="ruby-identifier">abs</span>, <span class="ruby-identifier">seconds</span>.<span class="ruby-identifier">abs</span>)&#x000A;258: <span class="ruby-keyword kw">else</span>&#x000A;259: <span class="ruby-identifier">s</span> = <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">&quot;%d:%02d:%02d.%03d&quot;</span>, <span class="ruby-identifier">hours</span>, <span class="ruby-identifier">minutes</span>.<span class="ruby-identifier">abs</span>, <span class="ruby-identifier">seconds</span>.<span class="ruby-identifier">abs</span>, <span class="ruby-identifier">_milliseconds</span>.<span class="ruby-identifier">abs</span>)&#x000A;260: <span class="ruby-keyword kw">end</span>&#x000A;261: <span class="ruby-keyword kw">else</span>&#x000A;262: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">_milliseconds</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>&#x000A;263: <span class="ruby-identifier">s</span> = <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">&quot;%dd:%02d:%02d:%02d&quot;</span>, <span class="ruby-identifier">_days</span>, <span class="ruby-identifier">hours</span>.<span class="ruby-identifier">abs</span>, <span class="ruby-identifier">minutes</span>.<span class="ruby-identifier">abs</span>, <span class="ruby-identifier">seconds</span>.<span class="ruby-identifier">abs</span>)&#x000A;264: <span class="ruby-keyword kw">else</span>&#x000A;265: <span class="ruby-identifier">s</span> = <span class="ruby-identifier">sprintf</span>(&#x000A;266: <span class="ruby-value str">&quot;%dd:%02d:%02d:%02d.%03d&quot;</span>,&#x000A;267: <span class="ruby-identifier">_days</span>,&#x000A;268: <span class="ruby-identifier">hours</span>.<span class="ruby-identifier">abs</span>,&#x000A;269: <span class="ruby-identifier">minutes</span>.<span class="ruby-identifier">abs</span>,&#x000A;270: <span class="ruby-identifier">seconds</span>.<span class="ruby-identifier">abs</span>,&#x000A;271: <span class="ruby-identifier">_milliseconds</span>.<span class="ruby-identifier">abs</span>)&#x000A;272: <span class="ruby-keyword kw">end</span>&#x000A;273: <span class="ruby-keyword kw">end</span>&#x000A;274: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">s</span>&#x000A;275: <span class="ruby-keyword kw">end</span></pre>
537
- </div>
538
- </div>
539
- <div class='method public-instance' id='method-M000022'>
540
- <a name='M000022'></a>
541
- <div class='synopsis'>
542
- <span class='name'>total_hours</span>
543
- <span class='arguments'>()</span>
544
- </div>
545
- <div class='description'>
546
- <p>
547
- Get the total number of hours in this time span. For example, if this time
548
- span represents two days, this method will return 48.
549
- </p>
550
- </div>
551
- <div class='source'>
552
- <a class='source-toggle' href='#' onclick="toggleCode('M000022-source'); return false">
553
- [show source]
554
- </a>
555
- <pre id='M000022-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_time_span.rb, line 137</span>&#x000A;137: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">total_hours</span>&#x000A;138: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sign</span> <span class="ruby-operator">*</span> (<span class="ruby-ivar">@totalMilliseconds</span>.<span class="ruby-identifier">abs</span> <span class="ruby-operator">/</span> <span class="ruby-constant">MILLISECONDS_IN_HOUR</span>)&#x000A;139: <span class="ruby-keyword kw">end</span></pre>
556
- </div>
557
- </div>
558
- <div class='method public-instance' id='method-M000025'>
559
- <a name='M000025'></a>
560
- <div class='synopsis'>
561
- <span class='name'>total_milliseconds</span>
562
- <span class='arguments'>()</span>
563
- </div>
564
- <div class='description'>
565
- <p>
566
- Get the total number of milliseconds in this time span. For example, if
567
- this time span represents 4 seconds, this method will return 4000.
568
- </p>
569
- </div>
570
- <div class='source'>
571
- <a class='source-toggle' href='#' onclick="toggleCode('M000025-source'); return false">
572
- [show source]
573
- </a>
574
- <pre id='M000025-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_time_span.rb, line 158</span>&#x000A;158: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">total_milliseconds</span>&#x000A;159: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@totalMilliseconds</span>&#x000A;160: <span class="ruby-keyword kw">end</span></pre>
575
- </div>
576
- </div>
577
- <div class='method public-instance' id='method-M000023'>
578
- <a name='M000023'></a>
579
- <div class='synopsis'>
580
- <span class='name'>total_minutes</span>
581
- <span class='arguments'>()</span>
582
- </div>
583
- <div class='description'>
584
- <p>
585
- Get the total number of minutes in this time span. For example, if this
586
- time span represents two hours, this method will return 120.
587
- </p>
588
- </div>
589
- <div class='source'>
590
- <a class='source-toggle' href='#' onclick="toggleCode('M000023-source'); return false">
591
- [show source]
592
- </a>
593
- <pre id='M000023-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_time_span.rb, line 144</span>&#x000A;144: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">total_minutes</span>&#x000A;145: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sign</span> <span class="ruby-operator">*</span> (<span class="ruby-ivar">@totalMilliseconds</span>.<span class="ruby-identifier">abs</span> <span class="ruby-operator">/</span> <span class="ruby-constant">MILLISECONDS_IN_MINUTE</span>)&#x000A;146: <span class="ruby-keyword kw">end</span></pre>
594
- </div>
595
- </div>
596
- <div class='method public-instance' id='method-M000024'>
597
- <a name='M000024'></a>
598
- <div class='synopsis'>
599
- <span class='name'>total_seconds</span>
600
- <span class='arguments'>()</span>
601
- </div>
602
- <div class='description'>
603
- <p>
604
- Get the total number of seconds in this time span. For example, if this
605
- time span represents three minutes, this method will return 180.
606
- </p>
607
- </div>
608
- <div class='source'>
609
- <a class='source-toggle' href='#' onclick="toggleCode('M000024-source'); return false">
610
- [show source]
611
- </a>
612
- <pre id='M000024-source'> <span class="ruby-comment cmt"># File lib/sdl4r/sdl_time_span.rb, line 151</span>&#x000A;151: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">total_seconds</span>&#x000A;152: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sign</span> <span class="ruby-operator">*</span> (<span class="ruby-ivar">@totalMilliseconds</span>.<span class="ruby-identifier">abs</span> <span class="ruby-operator">/</span> <span class="ruby-constant">MILLISECONDS_IN_SECOND</span>)&#x000A;153: <span class="ruby-keyword kw">end</span></pre>
613
- </div>
614
- </div>
615
- <div class='method public-instance' id='method-M000021'>
616
- <a name='M000021'></a>
617
- <div class='synopsis'>
618
- <span class='name'>usec</span>
619
- <span class='arguments'>()</span>
620
- </div>
621
- <div class='description'>
622
- <p>
623
- Alias for <a href="SdlTimeSpan.html#M000020">milliseconds</a>
624
- </p>
625
- </div>
626
- </div>
627
- </div>
628
- </div>
629
- </div>
630
- </div>
631
- <div id='footer-push'></div>
632
- </div>
633
- <div id='footer'>
634
- <a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
635
- </div>
636
- </body>
637
- </html>