cowtech-extensions 2.1.3 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/.yardopts +1 -0
- data/README.md +10 -0
- data/Rakefile +6 -3
- data/cowtech-extensions.gemspec +9 -5
- data/doc/Cowtech.html +128 -0
- data/doc/Cowtech/Extensions.html +546 -0
- data/doc/Cowtech/Extensions/Boolean.html +297 -0
- data/doc/Cowtech/Extensions/DateTime.html +787 -0
- data/doc/Cowtech/Extensions/DateTime/ClassMethods.html +1592 -0
- data/doc/Cowtech/Extensions/Exceptions.html +125 -0
- data/doc/Cowtech/Extensions/Exceptions/Dump.html +133 -0
- data/doc/Cowtech/Extensions/Hash.html +393 -0
- data/doc/Cowtech/Extensions/Math.html +130 -0
- data/doc/Cowtech/Extensions/Math/ClassMethods.html +362 -0
- data/doc/Cowtech/Extensions/Object.html +1565 -0
- data/doc/Cowtech/Extensions/Pathname.html +225 -0
- data/doc/Cowtech/Extensions/Settings.html +1249 -0
- data/doc/Cowtech/Extensions/String.html +471 -0
- data/doc/Cowtech/Extensions/TimeZone.html +1210 -0
- data/doc/Cowtech/Extensions/TimeZone/ClassMethods.html +925 -0
- data/doc/Cowtech/Extensions/Version.html +189 -0
- data/doc/_index.html +305 -0
- data/doc/class_list.html +53 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +328 -0
- data/doc/file.README.html +103 -0
- data/doc/file_list.html +55 -0
- data/doc/frames.html +28 -0
- data/doc/index.html +103 -0
- data/doc/js/app.js +214 -0
- data/doc/js/full_list.js +173 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +620 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/cowtech-extensions.rb +47 -16
- data/lib/cowtech-extensions/boolean.rb +8 -1
- data/lib/cowtech-extensions/datetime.rb +377 -71
- data/lib/cowtech-extensions/exceptions.rb +16 -0
- data/lib/cowtech-extensions/hash.rb +20 -9
- data/lib/cowtech-extensions/math.rb +15 -8
- data/lib/cowtech-extensions/object.rb +84 -27
- data/lib/cowtech-extensions/pathname.rb +10 -1
- data/lib/cowtech-extensions/settings.rb +120 -0
- data/lib/cowtech-extensions/string.rb +30 -3
- data/lib/cowtech-extensions/version.rb +11 -2
- data/spec/coverage_helper.rb +19 -0
- data/spec/cowtech-extensions/boolean_spec.rb +4 -0
- data/spec/cowtech-extensions/datetime_spec.rb +238 -79
- data/spec/cowtech-extensions/hash_spec.rb +5 -2
- data/spec/cowtech-extensions/math_spec.rb +14 -4
- data/spec/cowtech-extensions/object_spec.rb +19 -1
- data/spec/cowtech-extensions/pathname_spec.rb +5 -1
- data/spec/cowtech-extensions/settings_spec.rb +101 -0
- data/spec/cowtech-extensions/string_spec.rb +13 -0
- data/spec/cowtech-extensions_spec.rb +33 -13
- data/spec/spec_helper.rb +2 -5
- metadata +182 -97
- data/lib/cowtech-extensions/utils.rb +0 -74
@@ -0,0 +1,1210 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: Cowtech::Extensions::TimeZone
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.2.1
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../../';
|
20
|
+
framesUrl = "../../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../../_index.html">Index (T)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../Cowtech.html" title="Cowtech (module)">Cowtech</a></span></span> » <span class='title'><span class='object_link'><a href="../Extensions.html" title="Cowtech::Extensions (module)">Extensions</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">TimeZone</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: Cowtech::Extensions::TimeZone
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
<dt class="r1">Extended by:</dt>
|
77
|
+
<dd class="r1">ActiveSupport::Concern</dd>
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
<dt class="r2 last">Defined in:</dt>
|
86
|
+
<dd class="r2 last">lib/cowtech-extensions/datetime.rb</dd>
|
87
|
+
|
88
|
+
</dl>
|
89
|
+
<div class="clear"></div>
|
90
|
+
|
91
|
+
<h2>Overview</h2><div class="docstring">
|
92
|
+
<div class="discussion">
|
93
|
+
<p>Extensions for timezone objects.</p>
|
94
|
+
|
95
|
+
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
<div class="tags">
|
99
|
+
|
100
|
+
|
101
|
+
</div><h2>Defined Under Namespace</h2>
|
102
|
+
<p class="children">
|
103
|
+
|
104
|
+
|
105
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="TimeZone/ClassMethods.html" title="Cowtech::Extensions::TimeZone::ClassMethods (module)">ClassMethods</a></span>
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
</p>
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
<h2>
|
120
|
+
Instance Method Summary
|
121
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
122
|
+
</h2>
|
123
|
+
|
124
|
+
<ul class="summary">
|
125
|
+
|
126
|
+
<li class="public ">
|
127
|
+
<span class="summary_signature">
|
128
|
+
|
129
|
+
<a href="#current_offset-instance_method" title="#current_offset (instance method)">- (Fixnum|Rational) <strong>current_offset</strong>(rational = false, date = nil) </a>
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
</span>
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
<span class="summary_desc"><div class='inline'><p>Returns the current offset for this timezone, taking care of DST (Daylight Saving Time).</p>
|
144
|
+
</div></span>
|
145
|
+
|
146
|
+
</li>
|
147
|
+
|
148
|
+
|
149
|
+
<li class="public ">
|
150
|
+
<span class="summary_signature">
|
151
|
+
|
152
|
+
<a href="#dst_correction-instance_method" title="#dst_correction (instance method)">- (Fixnum|Rational) <strong>dst_correction</strong>(rational = false, year = nil) </a>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
</span>
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
<span class="summary_desc"><div class='inline'><p>Return the correction applied to the standard offset the timezone when the DST (Daylight Saving Time) is active.</p>
|
167
|
+
</div></span>
|
168
|
+
|
169
|
+
</li>
|
170
|
+
|
171
|
+
|
172
|
+
<li class="public ">
|
173
|
+
<span class="summary_signature">
|
174
|
+
|
175
|
+
<a href="#dst_offset-instance_method" title="#dst_offset (instance method)">- (Fixnum|Rational) <strong>dst_offset</strong>(rational = false, year = nil) </a>
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
</span>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
<span class="summary_desc"><div class='inline'><p>Returns the standard offset for this timezone timezone when the DST (Daylight Saving Time) is active.</p>
|
190
|
+
</div></span>
|
191
|
+
|
192
|
+
</li>
|
193
|
+
|
194
|
+
|
195
|
+
<li class="public ">
|
196
|
+
<span class="summary_signature">
|
197
|
+
|
198
|
+
<a href="#dst_period-instance_method" title="#dst_period (instance method)">- (TimezonePeriod) <strong>dst_period</strong>(year = nil) </a>
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
</span>
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
<span class="summary_desc"><div class='inline'><p>Gets a period for this timezone when the DST (Daylight Saving Time) is active (it takes care of different hemispheres).</p>
|
213
|
+
</div></span>
|
214
|
+
|
215
|
+
</li>
|
216
|
+
|
217
|
+
|
218
|
+
<li class="public ">
|
219
|
+
<span class="summary_signature">
|
220
|
+
|
221
|
+
<a href="#offset-instance_method" title="#offset (instance method)">- (Fixnum|Rational) <strong>offset</strong>(rational = false) </a>
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
</span>
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
<span class="summary_desc"><div class='inline'><p>Returns the standard offset for this timezone.</p>
|
236
|
+
</div></span>
|
237
|
+
|
238
|
+
</li>
|
239
|
+
|
240
|
+
|
241
|
+
<li class="public ">
|
242
|
+
<span class="summary_signature">
|
243
|
+
|
244
|
+
<a href="#to_s_parameterized-instance_method" title="#to_s_parameterized (instance method)">- (String) <strong>to_s_parameterized</strong>(with_offset = true) </a>
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
</span>
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
<span class="summary_desc"><div class='inline'><p>Returns the parametized name for this zone.</p>
|
259
|
+
</div></span>
|
260
|
+
|
261
|
+
</li>
|
262
|
+
|
263
|
+
|
264
|
+
<li class="public ">
|
265
|
+
<span class="summary_signature">
|
266
|
+
|
267
|
+
<a href="#to_s_with_dst-instance_method" title="#to_s_with_dst (instance method)">- (String) <strong>to_s_with_dst</strong>(dst_label = nil, year = nil) </a>
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
</span>
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
<span class="summary_desc"><div class='inline'><p>Returns the name for this zone with DST (Daylight Saving Time) active.</p>
|
282
|
+
</div></span>
|
283
|
+
|
284
|
+
</li>
|
285
|
+
|
286
|
+
|
287
|
+
<li class="public ">
|
288
|
+
<span class="summary_signature">
|
289
|
+
|
290
|
+
<a href="#to_s_with_dst_parameterized-instance_method" title="#to_s_with_dst_parameterized (instance method)">- (String) <strong>to_s_with_dst_parameterized</strong>(dst_label = nil, with_offset = true, year = nil) </a>
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
</span>
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
<span class="summary_desc"><div class='inline'><p>Returns the parametized name for this zone with DST (Daylight Saving Time) active.</p>
|
305
|
+
</div></span>
|
306
|
+
|
307
|
+
</li>
|
308
|
+
|
309
|
+
|
310
|
+
<li class="public ">
|
311
|
+
<span class="summary_signature">
|
312
|
+
|
313
|
+
<a href="#uses_dst%3F-instance_method" title="#uses_dst? (instance method)">- (Boolean) <strong>uses_dst?</strong>(year = nil) </a>
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
</span>
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
<span class="summary_desc"><div class='inline'><p>Checks if the timezone uses DST (Daylight Saving Time) for that year.</p>
|
328
|
+
</div></span>
|
329
|
+
|
330
|
+
</li>
|
331
|
+
|
332
|
+
|
333
|
+
</ul>
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
<div id="instance_method_details" class="method_details_list">
|
340
|
+
<h2>Instance Method Details</h2>
|
341
|
+
|
342
|
+
|
343
|
+
<div class="method_details first">
|
344
|
+
<h3 class="signature first" id="current_offset-instance_method">
|
345
|
+
|
346
|
+
- (<tt>Fixnum|Rational</tt>) <strong>current_offset</strong>(rational = false, date = nil)
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
</h3><div class="docstring">
|
353
|
+
<div class="discussion">
|
354
|
+
<p>Returns the current offset for this timezone, taking care of DST (Daylight Saving Time).</p>
|
355
|
+
|
356
|
+
|
357
|
+
</div>
|
358
|
+
</div>
|
359
|
+
<div class="tags">
|
360
|
+
<p class="tag_title">Parameters:</p>
|
361
|
+
<ul class="param">
|
362
|
+
|
363
|
+
<li>
|
364
|
+
|
365
|
+
<span class='name'>rational</span>
|
366
|
+
|
367
|
+
|
368
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Cowtech::Extensions::Boolean (module)">Boolean</a></span></tt>)</span>
|
369
|
+
|
370
|
+
|
371
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
372
|
+
|
373
|
+
|
374
|
+
—
|
375
|
+
<div class='inline'><p>If to return the offset as a Rational.</p>
|
376
|
+
</div>
|
377
|
+
|
378
|
+
</li>
|
379
|
+
|
380
|
+
<li>
|
381
|
+
|
382
|
+
<span class='name'>date</span>
|
383
|
+
|
384
|
+
|
385
|
+
<span class='type'>(<tt><span class='object_link'><a href="DateTime.html" title="Cowtech::Extensions::DateTime (module)">DateTime</a></span></tt>)</span>
|
386
|
+
|
387
|
+
|
388
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
389
|
+
|
390
|
+
|
391
|
+
—
|
392
|
+
<div class='inline'><p>The date to consider. Defaults to now.</p>
|
393
|
+
</div>
|
394
|
+
|
395
|
+
</li>
|
396
|
+
|
397
|
+
</ul>
|
398
|
+
|
399
|
+
<p class="tag_title">Returns:</p>
|
400
|
+
<ul class="return">
|
401
|
+
|
402
|
+
<li>
|
403
|
+
|
404
|
+
|
405
|
+
<span class='type'>(<tt>Fixnum|Rational</tt>)</span>
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
—
|
410
|
+
<div class='inline'><p>The offset of this timezone.</p>
|
411
|
+
</div>
|
412
|
+
|
413
|
+
</li>
|
414
|
+
|
415
|
+
</ul>
|
416
|
+
|
417
|
+
</div><table class="source_code">
|
418
|
+
<tr>
|
419
|
+
<td>
|
420
|
+
<pre class="lines">
|
421
|
+
|
422
|
+
|
423
|
+
373
|
424
|
+
374
|
425
|
+
375
|
426
|
+
376
|
427
|
+
377
|
428
|
+
378
|
429
|
+
379
|
430
|
+
380</pre>
|
431
|
+
</td>
|
432
|
+
<td>
|
433
|
+
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 373</span>
|
434
|
+
|
435
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_current_offset'>current_offset</span><span class='lparen'>(</span><span class='id identifier rubyid_rational'>rational</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_date'>date</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
436
|
+
<span class='id identifier rubyid_date'>date</span> <span class='op'>||=</span> <span class='op'>::</span><span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span>
|
437
|
+
|
438
|
+
<span class='id identifier rubyid_dst_period'>dst_period</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dst_period'>dst_period</span>
|
439
|
+
|
440
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_period_for_utc'>period_for_utc</span><span class='lparen'>(</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_utc'>utc</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_dst?'>dst?</span> <span class='op'>?</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dst_offset'>dst_offset</span> <span class='op'>:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_offset'>offset</span><span class='rparen'>)</span>
|
441
|
+
<span class='id identifier rubyid_rational'>rational</span> <span class='op'>?</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_rationalize_offset'>rationalize_offset</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_rv'>rv</span>
|
442
|
+
<span class='kw'>end</span></pre>
|
443
|
+
</td>
|
444
|
+
</tr>
|
445
|
+
</table>
|
446
|
+
</div>
|
447
|
+
|
448
|
+
<div class="method_details ">
|
449
|
+
<h3 class="signature " id="dst_correction-instance_method">
|
450
|
+
|
451
|
+
- (<tt>Fixnum|Rational</tt>) <strong>dst_correction</strong>(rational = false, year = nil)
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
</h3><div class="docstring">
|
458
|
+
<div class="discussion">
|
459
|
+
<p>Return the correction applied to the standard offset the timezone when the DST (Daylight Saving Time) is active.</p>
|
460
|
+
|
461
|
+
|
462
|
+
</div>
|
463
|
+
</div>
|
464
|
+
<div class="tags">
|
465
|
+
<p class="tag_title">Parameters:</p>
|
466
|
+
<ul class="param">
|
467
|
+
|
468
|
+
<li>
|
469
|
+
|
470
|
+
<span class='name'>rational</span>
|
471
|
+
|
472
|
+
|
473
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Cowtech::Extensions::Boolean (module)">Boolean</a></span></tt>)</span>
|
474
|
+
|
475
|
+
|
476
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
477
|
+
|
478
|
+
|
479
|
+
—
|
480
|
+
<div class='inline'><p>If to return the offset as a Rational.</p>
|
481
|
+
</div>
|
482
|
+
|
483
|
+
</li>
|
484
|
+
|
485
|
+
<li>
|
486
|
+
|
487
|
+
<span class='name'>year</span>
|
488
|
+
|
489
|
+
|
490
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
491
|
+
|
492
|
+
|
493
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
494
|
+
|
495
|
+
|
496
|
+
—
|
497
|
+
<div class='inline'><p>The year to which refer to. Defaults to the current year.</p>
|
498
|
+
</div>
|
499
|
+
|
500
|
+
</li>
|
501
|
+
|
502
|
+
</ul>
|
503
|
+
|
504
|
+
<p class="tag_title">Returns:</p>
|
505
|
+
<ul class="return">
|
506
|
+
|
507
|
+
<li>
|
508
|
+
|
509
|
+
|
510
|
+
<span class='type'>(<tt>Fixnum|Rational</tt>)</span>
|
511
|
+
|
512
|
+
|
513
|
+
|
514
|
+
—
|
515
|
+
<div class='inline'><p>The correction for dst.</p>
|
516
|
+
</div>
|
517
|
+
|
518
|
+
</li>
|
519
|
+
|
520
|
+
</ul>
|
521
|
+
|
522
|
+
</div><table class="source_code">
|
523
|
+
<tr>
|
524
|
+
<td>
|
525
|
+
<pre class="lines">
|
526
|
+
|
527
|
+
|
528
|
+
419
|
529
|
+
420
|
530
|
+
421
|
531
|
+
422
|
532
|
+
423</pre>
|
533
|
+
</td>
|
534
|
+
<td>
|
535
|
+
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 419</span>
|
536
|
+
|
537
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_dst_correction'>dst_correction</span><span class='lparen'>(</span><span class='id identifier rubyid_rational'>rational</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_year'>year</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
538
|
+
<span class='id identifier rubyid_period'>period</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dst_period'>dst_period</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span><span class='rparen'>)</span>
|
539
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_period'>period</span> <span class='op'>?</span> <span class='id identifier rubyid_period'>period</span><span class='period'>.</span><span class='id identifier rubyid_std_offset'>std_offset</span> <span class='op'>:</span> <span class='int'>0</span>
|
540
|
+
<span class='id identifier rubyid_rational'>rational</span> <span class='op'>?</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_rationalize_offset'>rationalize_offset</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_rv'>rv</span>
|
541
|
+
<span class='kw'>end</span></pre>
|
542
|
+
</td>
|
543
|
+
</tr>
|
544
|
+
</table>
|
545
|
+
</div>
|
546
|
+
|
547
|
+
<div class="method_details ">
|
548
|
+
<h3 class="signature " id="dst_offset-instance_method">
|
549
|
+
|
550
|
+
- (<tt>Fixnum|Rational</tt>) <strong>dst_offset</strong>(rational = false, year = nil)
|
551
|
+
|
552
|
+
|
553
|
+
|
554
|
+
|
555
|
+
|
556
|
+
</h3><div class="docstring">
|
557
|
+
<div class="discussion">
|
558
|
+
<p>Returns the standard offset for this timezone timezone when the DST (Daylight Saving Time) is active.</p>
|
559
|
+
|
560
|
+
|
561
|
+
</div>
|
562
|
+
</div>
|
563
|
+
<div class="tags">
|
564
|
+
<p class="tag_title">Parameters:</p>
|
565
|
+
<ul class="param">
|
566
|
+
|
567
|
+
<li>
|
568
|
+
|
569
|
+
<span class='name'>rational</span>
|
570
|
+
|
571
|
+
|
572
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Cowtech::Extensions::Boolean (module)">Boolean</a></span></tt>)</span>
|
573
|
+
|
574
|
+
|
575
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
576
|
+
|
577
|
+
|
578
|
+
—
|
579
|
+
<div class='inline'><p>If to return the offset as a Rational.</p>
|
580
|
+
</div>
|
581
|
+
|
582
|
+
</li>
|
583
|
+
|
584
|
+
<li>
|
585
|
+
|
586
|
+
<span class='name'>year</span>
|
587
|
+
|
588
|
+
|
589
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
590
|
+
|
591
|
+
|
592
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
593
|
+
|
594
|
+
|
595
|
+
—
|
596
|
+
<div class='inline'><p>The year to which refer to. Defaults to the current year.</p>
|
597
|
+
</div>
|
598
|
+
|
599
|
+
</li>
|
600
|
+
|
601
|
+
</ul>
|
602
|
+
|
603
|
+
<p class="tag_title">Returns:</p>
|
604
|
+
<ul class="return">
|
605
|
+
|
606
|
+
<li>
|
607
|
+
|
608
|
+
|
609
|
+
<span class='type'>(<tt>Fixnum|Rational</tt>)</span>
|
610
|
+
|
611
|
+
|
612
|
+
|
613
|
+
—
|
614
|
+
<div class='inline'><p>The DST offset for this timezone or <code>0</code> , if the timezone doesn't use DST for that year.</p>
|
615
|
+
</div>
|
616
|
+
|
617
|
+
</li>
|
618
|
+
|
619
|
+
</ul>
|
620
|
+
|
621
|
+
</div><table class="source_code">
|
622
|
+
<tr>
|
623
|
+
<td>
|
624
|
+
<pre class="lines">
|
625
|
+
|
626
|
+
|
627
|
+
430
|
628
|
+
431
|
629
|
+
432
|
630
|
+
433
|
631
|
+
434</pre>
|
632
|
+
</td>
|
633
|
+
<td>
|
634
|
+
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 430</span>
|
635
|
+
|
636
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_dst_offset'>dst_offset</span><span class='lparen'>(</span><span class='id identifier rubyid_rational'>rational</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_year'>year</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
637
|
+
<span class='id identifier rubyid_period'>period</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dst_period'>dst_period</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span><span class='rparen'>)</span>
|
638
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_period'>period</span> <span class='op'>?</span> <span class='id identifier rubyid_period'>period</span><span class='period'>.</span><span class='id identifier rubyid_utc_total_offset'>utc_total_offset</span> <span class='op'>:</span> <span class='int'>0</span>
|
639
|
+
<span class='id identifier rubyid_rational'>rational</span> <span class='op'>?</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_rationalize_offset'>rationalize_offset</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_rv'>rv</span>
|
640
|
+
<span class='kw'>end</span></pre>
|
641
|
+
</td>
|
642
|
+
</tr>
|
643
|
+
</table>
|
644
|
+
</div>
|
645
|
+
|
646
|
+
<div class="method_details ">
|
647
|
+
<h3 class="signature " id="dst_period-instance_method">
|
648
|
+
|
649
|
+
- (<tt>TimezonePeriod</tt>) <strong>dst_period</strong>(year = nil)
|
650
|
+
|
651
|
+
|
652
|
+
|
653
|
+
|
654
|
+
|
655
|
+
</h3><div class="docstring">
|
656
|
+
<div class="discussion">
|
657
|
+
<p>Gets a period for this timezone when the DST (Daylight Saving Time) is active (it takes care of different hemispheres).</p>
|
658
|
+
|
659
|
+
|
660
|
+
</div>
|
661
|
+
</div>
|
662
|
+
<div class="tags">
|
663
|
+
<p class="tag_title">Parameters:</p>
|
664
|
+
<ul class="param">
|
665
|
+
|
666
|
+
<li>
|
667
|
+
|
668
|
+
<span class='name'>year</span>
|
669
|
+
|
670
|
+
|
671
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
672
|
+
|
673
|
+
|
674
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
675
|
+
|
676
|
+
|
677
|
+
—
|
678
|
+
<div class='inline'><p>The year to which refer to. Defaults to the current year.</p>
|
679
|
+
</div>
|
680
|
+
|
681
|
+
</li>
|
682
|
+
|
683
|
+
</ul>
|
684
|
+
|
685
|
+
<p class="tag_title">Returns:</p>
|
686
|
+
<ul class="return">
|
687
|
+
|
688
|
+
<li>
|
689
|
+
|
690
|
+
|
691
|
+
<span class='type'>(<tt>TimezonePeriod</tt>)</span>
|
692
|
+
|
693
|
+
|
694
|
+
|
695
|
+
—
|
696
|
+
<div class='inline'><p>A period when the DST (Daylight Saving Time) is active or <code>nil</code> if the timezone doesn't use DST for that year.</p>
|
697
|
+
</div>
|
698
|
+
|
699
|
+
</li>
|
700
|
+
|
701
|
+
</ul>
|
702
|
+
|
703
|
+
</div><table class="source_code">
|
704
|
+
<tr>
|
705
|
+
<td>
|
706
|
+
<pre class="lines">
|
707
|
+
|
708
|
+
|
709
|
+
395
|
710
|
+
396
|
711
|
+
397
|
712
|
+
398
|
713
|
+
399
|
714
|
+
400
|
715
|
+
401
|
716
|
+
402
|
717
|
+
403
|
718
|
+
404</pre>
|
719
|
+
</td>
|
720
|
+
<td>
|
721
|
+
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 395</span>
|
722
|
+
|
723
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_dst_period'>dst_period</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
724
|
+
<span class='id identifier rubyid_year'>year</span> <span class='op'>||=</span> <span class='op'>::</span><span class='const'>Date</span><span class='period'>.</span><span class='id identifier rubyid_today'>today</span><span class='period'>.</span><span class='id identifier rubyid_year'>year</span>
|
725
|
+
|
726
|
+
<span class='id identifier rubyid_nothern_summer'>nothern_summer</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_civil'>civil</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span><span class='comma'>,</span> <span class='int'>7</span><span class='comma'>,</span> <span class='int'>15</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_utc'>utc</span> <span class='comment'># This is a representation of a summer period in the Northern Hemisphere.
|
727
|
+
</span> <span class='id identifier rubyid_southern_summer'>southern_summer</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_civil'>civil</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span><span class='comma'>,</span> <span class='int'>1</span><span class='comma'>,</span> <span class='int'>15</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_utc'>utc</span> <span class='comment'># This is a representation of a summer period in the Northern Hemisphere.
|
728
|
+
</span>
|
729
|
+
<span class='id identifier rubyid_period'>period</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_period_for_utc'>period_for_utc</span><span class='lparen'>(</span><span class='id identifier rubyid_nothern_summer'>nothern_summer</span><span class='rparen'>)</span>
|
730
|
+
<span class='id identifier rubyid_period'>period</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_period_for_utc'>period_for_utc</span><span class='lparen'>(</span><span class='id identifier rubyid_southern_summer'>southern_summer</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_period'>period</span><span class='period'>.</span><span class='id identifier rubyid_dst?'>dst?</span>
|
731
|
+
<span class='id identifier rubyid_period'>period</span><span class='period'>.</span><span class='id identifier rubyid_dst?'>dst?</span> <span class='op'>?</span> <span class='id identifier rubyid_period'>period</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
732
|
+
<span class='kw'>end</span></pre>
|
733
|
+
</td>
|
734
|
+
</tr>
|
735
|
+
</table>
|
736
|
+
</div>
|
737
|
+
|
738
|
+
<div class="method_details ">
|
739
|
+
<h3 class="signature " id="offset-instance_method">
|
740
|
+
|
741
|
+
- (<tt>Fixnum|Rational</tt>) <strong>offset</strong>(rational = false)
|
742
|
+
|
743
|
+
|
744
|
+
|
745
|
+
|
746
|
+
|
747
|
+
</h3><div class="docstring">
|
748
|
+
<div class="discussion">
|
749
|
+
<p>Returns the standard offset for this timezone.</p>
|
750
|
+
|
751
|
+
|
752
|
+
</div>
|
753
|
+
</div>
|
754
|
+
<div class="tags">
|
755
|
+
<p class="tag_title">Parameters:</p>
|
756
|
+
<ul class="param">
|
757
|
+
|
758
|
+
<li>
|
759
|
+
|
760
|
+
<span class='name'>rational</span>
|
761
|
+
|
762
|
+
|
763
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Cowtech::Extensions::Boolean (module)">Boolean</a></span></tt>)</span>
|
764
|
+
|
765
|
+
|
766
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
767
|
+
|
768
|
+
|
769
|
+
—
|
770
|
+
<div class='inline'><p>If to return the offset as a Rational.</p>
|
771
|
+
</div>
|
772
|
+
|
773
|
+
</li>
|
774
|
+
|
775
|
+
</ul>
|
776
|
+
|
777
|
+
<p class="tag_title">Returns:</p>
|
778
|
+
<ul class="return">
|
779
|
+
|
780
|
+
<li>
|
781
|
+
|
782
|
+
|
783
|
+
<span class='type'>(<tt>Fixnum|Rational</tt>)</span>
|
784
|
+
|
785
|
+
|
786
|
+
|
787
|
+
—
|
788
|
+
<div class='inline'><p>The offset of this timezone.</p>
|
789
|
+
</div>
|
790
|
+
|
791
|
+
</li>
|
792
|
+
|
793
|
+
</ul>
|
794
|
+
|
795
|
+
</div><table class="source_code">
|
796
|
+
<tr>
|
797
|
+
<td>
|
798
|
+
<pre class="lines">
|
799
|
+
|
800
|
+
|
801
|
+
386
|
802
|
+
387
|
803
|
+
388
|
804
|
+
389</pre>
|
805
|
+
</td>
|
806
|
+
<td>
|
807
|
+
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 386</span>
|
808
|
+
|
809
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_offset'>offset</span><span class='lparen'>(</span><span class='id identifier rubyid_rational'>rational</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
810
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_utc_offset'>utc_offset</span>
|
811
|
+
<span class='id identifier rubyid_rational'>rational</span> <span class='op'>?</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_rationalize_offset'>rationalize_offset</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_rv'>rv</span>
|
812
|
+
<span class='kw'>end</span></pre>
|
813
|
+
</td>
|
814
|
+
</tr>
|
815
|
+
</table>
|
816
|
+
</div>
|
817
|
+
|
818
|
+
<div class="method_details ">
|
819
|
+
<h3 class="signature " id="to_s_parameterized-instance_method">
|
820
|
+
|
821
|
+
- (<tt><span class='object_link'><a href="String.html" title="Cowtech::Extensions::String (module)">String</a></span></tt>) <strong>to_s_parameterized</strong>(with_offset = true)
|
822
|
+
|
823
|
+
|
824
|
+
|
825
|
+
|
826
|
+
|
827
|
+
</h3><div class="docstring">
|
828
|
+
<div class="discussion">
|
829
|
+
<p>Returns the parametized name for this zone.</p>
|
830
|
+
|
831
|
+
|
832
|
+
</div>
|
833
|
+
</div>
|
834
|
+
<div class="tags">
|
835
|
+
<p class="tag_title">Parameters:</p>
|
836
|
+
<ul class="param">
|
837
|
+
|
838
|
+
<li>
|
839
|
+
|
840
|
+
<span class='name'>with_offset</span>
|
841
|
+
|
842
|
+
|
843
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Cowtech::Extensions::Boolean (module)">Boolean</a></span></tt>)</span>
|
844
|
+
|
845
|
+
|
846
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
847
|
+
|
848
|
+
|
849
|
+
—
|
850
|
+
<div class='inline'><p>If to include offset into the representation.</p>
|
851
|
+
</div>
|
852
|
+
|
853
|
+
</li>
|
854
|
+
|
855
|
+
</ul>
|
856
|
+
|
857
|
+
<p class="tag_title">Returns:</p>
|
858
|
+
<ul class="return">
|
859
|
+
|
860
|
+
<li>
|
861
|
+
|
862
|
+
|
863
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Cowtech::Extensions::String (module)">String</a></span></tt>)</span>
|
864
|
+
|
865
|
+
|
866
|
+
|
867
|
+
—
|
868
|
+
<div class='inline'><p>The parametized name for this zone.</p>
|
869
|
+
</div>
|
870
|
+
|
871
|
+
</li>
|
872
|
+
|
873
|
+
</ul>
|
874
|
+
|
875
|
+
</div><table class="source_code">
|
876
|
+
<tr>
|
877
|
+
<td>
|
878
|
+
<pre class="lines">
|
879
|
+
|
880
|
+
|
881
|
+
457
|
882
|
+
458
|
883
|
+
459</pre>
|
884
|
+
</td>
|
885
|
+
<td>
|
886
|
+
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 457</span>
|
887
|
+
|
888
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_s_parameterized'>to_s_parameterized</span><span class='lparen'>(</span><span class='id identifier rubyid_with_offset'>with_offset</span> <span class='op'>=</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
889
|
+
<span class='op'>::</span><span class='const'>ActiveSupport</span><span class='op'>::</span><span class='const'>TimeZone</span><span class='period'>.</span><span class='id identifier rubyid_parameterize_zone'>parameterize_zone</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span> <span class='id identifier rubyid_with_offset'>with_offset</span><span class='rparen'>)</span>
|
890
|
+
<span class='kw'>end</span></pre>
|
891
|
+
</td>
|
892
|
+
</tr>
|
893
|
+
</table>
|
894
|
+
</div>
|
895
|
+
|
896
|
+
<div class="method_details ">
|
897
|
+
<h3 class="signature " id="to_s_with_dst-instance_method">
|
898
|
+
|
899
|
+
- (<tt><span class='object_link'><a href="String.html" title="Cowtech::Extensions::String (module)">String</a></span></tt>) <strong>to_s_with_dst</strong>(dst_label = nil, year = nil)
|
900
|
+
|
901
|
+
|
902
|
+
|
903
|
+
|
904
|
+
|
905
|
+
</h3><div class="docstring">
|
906
|
+
<div class="discussion">
|
907
|
+
<p>Returns the name for this zone with DST (Daylight Saving Time) active.</p>
|
908
|
+
|
909
|
+
|
910
|
+
</div>
|
911
|
+
</div>
|
912
|
+
<div class="tags">
|
913
|
+
<p class="tag_title">Parameters:</p>
|
914
|
+
<ul class="param">
|
915
|
+
|
916
|
+
<li>
|
917
|
+
|
918
|
+
<span class='name'>dst_label</span>
|
919
|
+
|
920
|
+
|
921
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Cowtech::Extensions::String (module)">String</a></span></tt>)</span>
|
922
|
+
|
923
|
+
|
924
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
925
|
+
|
926
|
+
|
927
|
+
—
|
928
|
+
<div class='inline'><p>Label for the DST indication. Defaults to <code>(Daylight Saving Time)</code>.</p>
|
929
|
+
</div>
|
930
|
+
|
931
|
+
</li>
|
932
|
+
|
933
|
+
<li>
|
934
|
+
|
935
|
+
<span class='name'>year</span>
|
936
|
+
|
937
|
+
|
938
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
939
|
+
|
940
|
+
|
941
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
942
|
+
|
943
|
+
|
944
|
+
—
|
945
|
+
<div class='inline'><p>The year to which refer to. Defaults to the current year.</p>
|
946
|
+
</div>
|
947
|
+
|
948
|
+
</li>
|
949
|
+
|
950
|
+
</ul>
|
951
|
+
|
952
|
+
<p class="tag_title">Returns:</p>
|
953
|
+
<ul class="return">
|
954
|
+
|
955
|
+
<li>
|
956
|
+
|
957
|
+
|
958
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Cowtech::Extensions::String (module)">String</a></span></tt>)</span>
|
959
|
+
|
960
|
+
|
961
|
+
|
962
|
+
—
|
963
|
+
<div class='inline'><p>The name for the zone with DST or <code>nil</code>, if the timezone doesn't use DST for that year.</p>
|
964
|
+
</div>
|
965
|
+
|
966
|
+
</li>
|
967
|
+
|
968
|
+
</ul>
|
969
|
+
|
970
|
+
</div><table class="source_code">
|
971
|
+
<tr>
|
972
|
+
<td>
|
973
|
+
<pre class="lines">
|
974
|
+
|
975
|
+
|
976
|
+
441
|
977
|
+
442
|
978
|
+
443
|
979
|
+
444
|
980
|
+
445
|
981
|
+
446
|
982
|
+
447
|
983
|
+
448
|
984
|
+
449
|
985
|
+
450
|
986
|
+
451</pre>
|
987
|
+
</td>
|
988
|
+
<td>
|
989
|
+
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 441</span>
|
990
|
+
|
991
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_s_with_dst'>to_s_with_dst</span><span class='lparen'>(</span><span class='id identifier rubyid_dst_label'>dst_label</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_year'>year</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
992
|
+
<span class='id identifier rubyid_dst_label'>dst_label</span> <span class='op'>||=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>(Daylight Saving Time)</span><span class='tstring_end'>"</span></span>
|
993
|
+
|
994
|
+
<span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_uses_dst?'>uses_dst?</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
995
|
+
<span class='id identifier rubyid_period'>period</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dst_period'>dst_period</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span><span class='rparen'>)</span>
|
996
|
+
<span class='id identifier rubyid_offset'>offset</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_seconds_to_utc_offset'>seconds_to_utc_offset</span><span class='lparen'>(</span><span class='id identifier rubyid_period'>period</span><span class='period'>.</span><span class='id identifier rubyid_utc_total_offset'>utc_total_offset</span><span class='rparen'>)</span>
|
997
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>(GMT</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_offset'>offset</span><span class='rbrace'>}</span><span class='tstring_content'>) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='rbrace'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_dst_label'>dst_label</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
998
|
+
<span class='kw'>else</span>
|
999
|
+
<span class='kw'>nil</span>
|
1000
|
+
<span class='kw'>end</span>
|
1001
|
+
<span class='kw'>end</span></pre>
|
1002
|
+
</td>
|
1003
|
+
</tr>
|
1004
|
+
</table>
|
1005
|
+
</div>
|
1006
|
+
|
1007
|
+
<div class="method_details ">
|
1008
|
+
<h3 class="signature " id="to_s_with_dst_parameterized-instance_method">
|
1009
|
+
|
1010
|
+
- (<tt><span class='object_link'><a href="String.html" title="Cowtech::Extensions::String (module)">String</a></span></tt>) <strong>to_s_with_dst_parameterized</strong>(dst_label = nil, with_offset = true, year = nil)
|
1011
|
+
|
1012
|
+
|
1013
|
+
|
1014
|
+
|
1015
|
+
|
1016
|
+
</h3><div class="docstring">
|
1017
|
+
<div class="discussion">
|
1018
|
+
<p>Returns the parametized name for this zone with DST (Daylight Saving Time) active.</p>
|
1019
|
+
|
1020
|
+
|
1021
|
+
</div>
|
1022
|
+
</div>
|
1023
|
+
<div class="tags">
|
1024
|
+
<p class="tag_title">Parameters:</p>
|
1025
|
+
<ul class="param">
|
1026
|
+
|
1027
|
+
<li>
|
1028
|
+
|
1029
|
+
<span class='name'>dst_label</span>
|
1030
|
+
|
1031
|
+
|
1032
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Cowtech::Extensions::String (module)">String</a></span></tt>)</span>
|
1033
|
+
|
1034
|
+
|
1035
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1036
|
+
|
1037
|
+
|
1038
|
+
—
|
1039
|
+
<div class='inline'><p>Label for the DST indication. Defaults to <code>(Daylight Saving Time)</code>.</p>
|
1040
|
+
</div>
|
1041
|
+
|
1042
|
+
</li>
|
1043
|
+
|
1044
|
+
<li>
|
1045
|
+
|
1046
|
+
<span class='name'>with_offset</span>
|
1047
|
+
|
1048
|
+
|
1049
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Cowtech::Extensions::Boolean (module)">Boolean</a></span></tt>)</span>
|
1050
|
+
|
1051
|
+
|
1052
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
1053
|
+
|
1054
|
+
|
1055
|
+
—
|
1056
|
+
<div class='inline'><p>If to include offset into the representation.</p>
|
1057
|
+
</div>
|
1058
|
+
|
1059
|
+
</li>
|
1060
|
+
|
1061
|
+
<li>
|
1062
|
+
|
1063
|
+
<span class='name'>year</span>
|
1064
|
+
|
1065
|
+
|
1066
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
1067
|
+
|
1068
|
+
|
1069
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1070
|
+
|
1071
|
+
|
1072
|
+
—
|
1073
|
+
<div class='inline'><p>The year to which refer to. Defaults to the current year.</p>
|
1074
|
+
</div>
|
1075
|
+
|
1076
|
+
</li>
|
1077
|
+
|
1078
|
+
</ul>
|
1079
|
+
|
1080
|
+
<p class="tag_title">Returns:</p>
|
1081
|
+
<ul class="return">
|
1082
|
+
|
1083
|
+
<li>
|
1084
|
+
|
1085
|
+
|
1086
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Cowtech::Extensions::String (module)">String</a></span></tt>)</span>
|
1087
|
+
|
1088
|
+
|
1089
|
+
|
1090
|
+
—
|
1091
|
+
<div class='inline'><p>The parametized name for this zone with DST or <code>nil</code>, if the timezone doesn't use DST for that year.</p>
|
1092
|
+
</div>
|
1093
|
+
|
1094
|
+
</li>
|
1095
|
+
|
1096
|
+
</ul>
|
1097
|
+
|
1098
|
+
</div><table class="source_code">
|
1099
|
+
<tr>
|
1100
|
+
<td>
|
1101
|
+
<pre class="lines">
|
1102
|
+
|
1103
|
+
|
1104
|
+
467
|
1105
|
+
468
|
1106
|
+
469
|
1107
|
+
470</pre>
|
1108
|
+
</td>
|
1109
|
+
<td>
|
1110
|
+
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 467</span>
|
1111
|
+
|
1112
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_s_with_dst_parameterized'>to_s_with_dst_parameterized</span><span class='lparen'>(</span><span class='id identifier rubyid_dst_label'>dst_label</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_with_offset'>with_offset</span> <span class='op'>=</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_year'>year</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1113
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_s_with_dst'>to_s_with_dst</span><span class='lparen'>(</span><span class='id identifier rubyid_dst_label'>dst_label</span><span class='comma'>,</span> <span class='id identifier rubyid_year'>year</span><span class='rparen'>)</span>
|
1114
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>?</span> <span class='op'>::</span><span class='const'>ActiveSupport</span><span class='op'>::</span><span class='const'>TimeZone</span><span class='period'>.</span><span class='id identifier rubyid_parameterize_zone'>parameterize_zone</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
1115
|
+
<span class='kw'>end</span></pre>
|
1116
|
+
</td>
|
1117
|
+
</tr>
|
1118
|
+
</table>
|
1119
|
+
</div>
|
1120
|
+
|
1121
|
+
<div class="method_details ">
|
1122
|
+
<h3 class="signature " id="uses_dst?-instance_method">
|
1123
|
+
|
1124
|
+
- (<tt><span class='object_link'><a href="Boolean.html" title="Cowtech::Extensions::Boolean (module)">Boolean</a></span></tt>) <strong>uses_dst?</strong>(year = nil)
|
1125
|
+
|
1126
|
+
|
1127
|
+
|
1128
|
+
|
1129
|
+
|
1130
|
+
</h3><div class="docstring">
|
1131
|
+
<div class="discussion">
|
1132
|
+
<p>Checks if the timezone uses DST (Daylight Saving Time) for that year.</p>
|
1133
|
+
|
1134
|
+
|
1135
|
+
</div>
|
1136
|
+
</div>
|
1137
|
+
<div class="tags">
|
1138
|
+
<p class="tag_title">Parameters:</p>
|
1139
|
+
<ul class="param">
|
1140
|
+
|
1141
|
+
<li>
|
1142
|
+
|
1143
|
+
<span class='name'>year</span>
|
1144
|
+
|
1145
|
+
|
1146
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
1147
|
+
|
1148
|
+
|
1149
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1150
|
+
|
1151
|
+
|
1152
|
+
—
|
1153
|
+
<div class='inline'><p>The year to check. Defaults to the current year.</p>
|
1154
|
+
</div>
|
1155
|
+
|
1156
|
+
</li>
|
1157
|
+
|
1158
|
+
</ul>
|
1159
|
+
|
1160
|
+
<p class="tag_title">Returns:</p>
|
1161
|
+
<ul class="return">
|
1162
|
+
|
1163
|
+
<li>
|
1164
|
+
|
1165
|
+
|
1166
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Cowtech::Extensions::Boolean (module)">Boolean</a></span></tt>)</span>
|
1167
|
+
|
1168
|
+
|
1169
|
+
|
1170
|
+
—
|
1171
|
+
<div class='inline'><p><code>true</code> if the zone uses DST, <code>false</code> otherwise.</p>
|
1172
|
+
</div>
|
1173
|
+
|
1174
|
+
</li>
|
1175
|
+
|
1176
|
+
</ul>
|
1177
|
+
|
1178
|
+
</div><table class="source_code">
|
1179
|
+
<tr>
|
1180
|
+
<td>
|
1181
|
+
<pre class="lines">
|
1182
|
+
|
1183
|
+
|
1184
|
+
410
|
1185
|
+
411
|
1186
|
+
412</pre>
|
1187
|
+
</td>
|
1188
|
+
<td>
|
1189
|
+
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 410</span>
|
1190
|
+
|
1191
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_uses_dst?'>uses_dst?</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1192
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dst_period'>dst_period</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
1193
|
+
<span class='kw'>end</span></pre>
|
1194
|
+
</td>
|
1195
|
+
</tr>
|
1196
|
+
</table>
|
1197
|
+
</div>
|
1198
|
+
|
1199
|
+
</div>
|
1200
|
+
|
1201
|
+
</div>
|
1202
|
+
|
1203
|
+
<div id="footer">
|
1204
|
+
Generated on Thu Jul 19 17:17:51 2012 by
|
1205
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1206
|
+
0.8.2.1 (ruby-1.9.2).
|
1207
|
+
</div>
|
1208
|
+
|
1209
|
+
</body>
|
1210
|
+
</html>
|