lazier 1.0.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 +6 -0
- data/.travis.yml +8 -0
- data/.yardopts +1 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +82 -0
- data/README.md +33 -0
- data/Rakefile +18 -0
- data/doc/Lazier.html +557 -0
- data/doc/Lazier/Boolean.html +297 -0
- data/doc/Lazier/DateTime.html +787 -0
- data/doc/Lazier/DateTime/ClassMethods.html +1592 -0
- data/doc/Lazier/Exceptions.html +125 -0
- data/doc/Lazier/Exceptions/Dump.html +133 -0
- data/doc/Lazier/Hash.html +393 -0
- data/doc/Lazier/Math.html +130 -0
- data/doc/Lazier/Math/ClassMethods.html +362 -0
- data/doc/Lazier/Object.html +1565 -0
- data/doc/Lazier/Pathname.html +225 -0
- data/doc/Lazier/Settings.html +1249 -0
- data/doc/Lazier/String.html +471 -0
- data/doc/Lazier/TimeZone.html +1675 -0
- data/doc/Lazier/TimeZone/ClassMethods.html +1055 -0
- data/doc/Lazier/Version.html +189 -0
- data/doc/_index.html +306 -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 +107 -0
- data/doc/file_list.html +55 -0
- data/doc/frames.html +28 -0
- data/doc/index.html +107 -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 +652 -0
- data/doc/top-level-namespace.html +112 -0
- data/lazier.gemspec +36 -0
- data/lib/lazier.rb +127 -0
- data/lib/lazier/boolean.rb +26 -0
- data/lib/lazier/datetime.rb +548 -0
- data/lib/lazier/exceptions.rb +14 -0
- data/lib/lazier/hash.rb +40 -0
- data/lib/lazier/math.rb +47 -0
- data/lib/lazier/object.rb +163 -0
- data/lib/lazier/pathname.rb +26 -0
- data/lib/lazier/settings.rb +118 -0
- data/lib/lazier/string.rb +54 -0
- data/lib/lazier/version.rb +24 -0
- data/spec/coverage_helper.rb +19 -0
- data/spec/cowtech-extensions/boolean_spec.rb +30 -0
- data/spec/cowtech-extensions/datetime_spec.rb +352 -0
- data/spec/cowtech-extensions/hash_spec.rb +30 -0
- data/spec/cowtech-extensions/math_spec.rb +41 -0
- data/spec/cowtech-extensions/object_spec.rb +231 -0
- data/spec/cowtech-extensions/pathname_spec.rb +21 -0
- data/spec/cowtech-extensions/settings_spec.rb +118 -0
- data/spec/cowtech-extensions/string_spec.rb +45 -0
- data/spec/lazier_spec.rb +57 -0
- data/spec/spec_helper.rb +16 -0
- metadata +292 -0
@@ -0,0 +1,1675 @@
|
|
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: Lazier::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="../Lazier.html" title="Lazier (module)">Lazier</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: Lazier::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/lazier/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="Lazier::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="#aliases-instance_method" title="#aliases (instance method)">- (Array) <strong>aliases</strong>(dst_label = 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 a list of valid aliases (city names) for this timezone (basing on offset).</p>
|
144
|
+
</div></span>
|
145
|
+
|
146
|
+
</li>
|
147
|
+
|
148
|
+
|
149
|
+
<li class="public ">
|
150
|
+
<span class="summary_signature">
|
151
|
+
|
152
|
+
<a href="#current_offset-instance_method" title="#current_offset (instance method)">- (Fixnum|Rational) <strong>current_offset</strong>(rational = false, date = 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>Returns the current offset for this timezone, taking care of Daylight Saving Time (DST).</p>
|
167
|
+
</div></span>
|
168
|
+
|
169
|
+
</li>
|
170
|
+
|
171
|
+
|
172
|
+
<li class="public ">
|
173
|
+
<span class="summary_signature">
|
174
|
+
|
175
|
+
<a href="#dst_correction-instance_method" title="#dst_correction (instance method)">- (Fixnum|Rational) <strong>dst_correction</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>Return the correction applied to the standard offset the timezone when the Daylight Saving Time (DST) 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_name-instance_method" title="#dst_name (instance method)">- (String) <strong>dst_name</strong>(dst_label = nil, year = nil, name = 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>Returns the name for this zone with Daylight Saving Time (DST) active.</p>
|
213
|
+
</div></span>
|
214
|
+
|
215
|
+
</li>
|
216
|
+
|
217
|
+
|
218
|
+
<li class="public ">
|
219
|
+
<span class="summary_signature">
|
220
|
+
|
221
|
+
<a href="#dst_offset-instance_method" title="#dst_offset (instance method)">- (Fixnum|Rational) <strong>dst_offset</strong>(rational = false, year = nil) </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 timezone when the Daylight Saving Time (DST) is active.</p>
|
236
|
+
</div></span>
|
237
|
+
|
238
|
+
</li>
|
239
|
+
|
240
|
+
|
241
|
+
<li class="public ">
|
242
|
+
<span class="summary_signature">
|
243
|
+
|
244
|
+
<a href="#dst_period-instance_method" title="#dst_period (instance method)">- (TimezonePeriod) <strong>dst_period</strong>(year = nil) </a>
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
</span>
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
<span class="summary_desc"><div class='inline'><p>Gets a period for this timezone when the Daylight Saving Time (DST) is active (it takes care of different hemispheres).</p>
|
259
|
+
</div></span>
|
260
|
+
|
261
|
+
</li>
|
262
|
+
|
263
|
+
|
264
|
+
<li class="public ">
|
265
|
+
<span class="summary_signature">
|
266
|
+
|
267
|
+
<a href="#offset-instance_method" title="#offset (instance method)">- (Fixnum|Rational) <strong>offset</strong>(rational = false) </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 standard offset for this timezone.</p>
|
282
|
+
</div></span>
|
283
|
+
|
284
|
+
</li>
|
285
|
+
|
286
|
+
|
287
|
+
<li class="public ">
|
288
|
+
<span class="summary_signature">
|
289
|
+
|
290
|
+
<a href="#to_str-instance_method" title="#to_str (instance method)">- (String) <strong>to_str</strong>(name = nil, colon = true) </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 name for this zone with Daylight Saving Time (DST) active.</p>
|
305
|
+
</div></span>
|
306
|
+
|
307
|
+
</li>
|
308
|
+
|
309
|
+
|
310
|
+
<li class="public ">
|
311
|
+
<span class="summary_signature">
|
312
|
+
|
313
|
+
<a href="#to_str_parameterized-instance_method" title="#to_str_parameterized (instance method)">- (String) <strong>to_str_parameterized</strong>(with_offset = true, name = 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>Returns a parametized string representation for this zone.</p>
|
328
|
+
</div></span>
|
329
|
+
|
330
|
+
</li>
|
331
|
+
|
332
|
+
|
333
|
+
<li class="public ">
|
334
|
+
<span class="summary_signature">
|
335
|
+
|
336
|
+
<a href="#to_str_with_dst-instance_method" title="#to_str_with_dst (instance method)">- (String) <strong>to_str_with_dst</strong>(dst_label = nil, year = nil, name = nil) </a>
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
</span>
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
<span class="summary_desc"><div class='inline'><p>Returns a string representation for this zone with Daylight Saving Time (DST) active.</p>
|
351
|
+
</div></span>
|
352
|
+
|
353
|
+
</li>
|
354
|
+
|
355
|
+
|
356
|
+
<li class="public ">
|
357
|
+
<span class="summary_signature">
|
358
|
+
|
359
|
+
<a href="#to_str_with_dst_parameterized-instance_method" title="#to_str_with_dst_parameterized (instance method)">- (String) <strong>to_str_with_dst_parameterized</strong>(dst_label = nil, with_offset = true, year = nil, name = nil) </a>
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
</span>
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
<span class="summary_desc"><div class='inline'><p>Returns a parametized string representation for this zone with Daylight Saving Time (DST) active.</p>
|
374
|
+
</div></span>
|
375
|
+
|
376
|
+
</li>
|
377
|
+
|
378
|
+
|
379
|
+
<li class="public ">
|
380
|
+
<span class="summary_signature">
|
381
|
+
|
382
|
+
<a href="#uses_dst%3F-instance_method" title="#uses_dst? (instance method)">- (Boolean) <strong>uses_dst?</strong>(reference = nil) </a>
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
</span>
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
<span class="summary_desc"><div class='inline'><p>Checks if the timezone uses Daylight Saving Time (DST) for that date or year.</p>
|
397
|
+
</div></span>
|
398
|
+
|
399
|
+
</li>
|
400
|
+
|
401
|
+
|
402
|
+
</ul>
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
<div id="instance_method_details" class="method_details_list">
|
409
|
+
<h2>Instance Method Details</h2>
|
410
|
+
|
411
|
+
|
412
|
+
<div class="method_details first">
|
413
|
+
<h3 class="signature first" id="aliases-instance_method">
|
414
|
+
|
415
|
+
- (<tt>Array</tt>) <strong>aliases</strong>(dst_label = nil)
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
</h3><div class="docstring">
|
422
|
+
<div class="discussion">
|
423
|
+
<p>Returns a list of valid aliases (city names) for this timezone (basing on offset).</p>
|
424
|
+
|
425
|
+
|
426
|
+
</div>
|
427
|
+
</div>
|
428
|
+
<div class="tags">
|
429
|
+
<p class="tag_title">Parameters:</p>
|
430
|
+
<ul class="param">
|
431
|
+
|
432
|
+
<li>
|
433
|
+
|
434
|
+
<span class='name'>dst_label</span>
|
435
|
+
|
436
|
+
|
437
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
438
|
+
|
439
|
+
|
440
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
441
|
+
|
442
|
+
|
443
|
+
—
|
444
|
+
<div class='inline'><p>Label for the DST indication. Defaults to <code>(DST)</code>.</p>
|
445
|
+
</div>
|
446
|
+
|
447
|
+
</li>
|
448
|
+
|
449
|
+
</ul>
|
450
|
+
|
451
|
+
<p class="tag_title">Returns:</p>
|
452
|
+
<ul class="return">
|
453
|
+
|
454
|
+
<li>
|
455
|
+
|
456
|
+
|
457
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
458
|
+
|
459
|
+
|
460
|
+
|
461
|
+
—
|
462
|
+
<div class='inline'><p>A list of aliases for this timezone</p>
|
463
|
+
</div>
|
464
|
+
|
465
|
+
</li>
|
466
|
+
|
467
|
+
</ul>
|
468
|
+
|
469
|
+
</div><table class="source_code">
|
470
|
+
<tr>
|
471
|
+
<td>
|
472
|
+
<pre class="lines">
|
473
|
+
|
474
|
+
|
475
|
+
388
|
476
|
+
389
|
477
|
+
390
|
478
|
+
391
|
479
|
+
392
|
480
|
+
393
|
481
|
+
394
|
482
|
+
395
|
483
|
+
396
|
484
|
+
397
|
485
|
+
398
|
486
|
+
399
|
487
|
+
400
|
488
|
+
401
|
489
|
+
402
|
490
|
+
403
|
491
|
+
404
|
492
|
+
405
|
493
|
+
406
|
494
|
+
407
|
495
|
+
408
|
496
|
+
409
|
497
|
+
410
|
498
|
+
411</pre>
|
499
|
+
</td>
|
500
|
+
<td>
|
501
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 388</span>
|
502
|
+
|
503
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_aliases'>aliases</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='rparen'>)</span>
|
504
|
+
<span class='id identifier rubyid_reference'>reference</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span>
|
505
|
+
<span class='id identifier rubyid_reference'>reference</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='op'>::</span><span class='const'>MAPPING</span><span class='lbracket'>[</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='op'>::</span><span class='const'>MAPPING</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span> <span class='comment'># We are an alias
|
506
|
+
</span> <span class='id identifier rubyid_reference'>reference</span> <span class='op'>=</span> <span class='id identifier rubyid_reference'>reference</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>_</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> </span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
507
|
+
|
508
|
+
<span class='kw'>if</span> <span class='ivar'>@aliases</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span> <span class='kw'>then</span>
|
509
|
+
<span class='comment'># First we search for aliases by name
|
510
|
+
</span> <span class='ivar'>@aliases</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_reference'>reference</span><span class='rbracket'>]</span>
|
511
|
+
|
512
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='op'>::</span><span class='const'>MAPPING</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_zone'>zone</span><span class='op'>|</span>
|
513
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_zone'>zone</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>_</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> </span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='op'>==</span> <span class='id identifier rubyid_reference'>reference</span> <span class='kw'>then</span>
|
514
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>International Date Line West</span><span class='tstring_end'>"</span></span> <span class='op'>||</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>UTC</span><span class='tstring_end'>"</span></span> <span class='op'>||</span> <span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>(US & Canada)</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
515
|
+
<span class='ivar'>@aliases</span> <span class='op'><<</span> <span class='id identifier rubyid_name'>name</span>
|
516
|
+
<span class='kw'>else</span>
|
517
|
+
<span class='ivar'>@aliases</span> <span class='op'><<</span> <span class='id identifier rubyid_reference'>reference</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\/.*</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/</span><span class='tstring_end'>"</span></span> <span class='op'>+</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
518
|
+
<span class='kw'>end</span>
|
519
|
+
<span class='kw'>end</span>
|
520
|
+
<span class='kw'>end</span>
|
521
|
+
|
522
|
+
<span class='ivar'>@aliases</span> <span class='op'>=</span> <span class='ivar'>@aliases</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span>
|
523
|
+
<span class='kw'>end</span>
|
524
|
+
|
525
|
+
<span class='ivar'>@aliases</span>
|
526
|
+
<span class='kw'>end</span></pre>
|
527
|
+
</td>
|
528
|
+
</tr>
|
529
|
+
</table>
|
530
|
+
</div>
|
531
|
+
|
532
|
+
<div class="method_details ">
|
533
|
+
<h3 class="signature " id="current_offset-instance_method">
|
534
|
+
|
535
|
+
- (<tt>Fixnum|Rational</tt>) <strong>current_offset</strong>(rational = false, date = nil)
|
536
|
+
|
537
|
+
|
538
|
+
|
539
|
+
|
540
|
+
|
541
|
+
</h3><div class="docstring">
|
542
|
+
<div class="discussion">
|
543
|
+
<p>Returns the current offset for this timezone, taking care of Daylight Saving Time (DST).</p>
|
544
|
+
|
545
|
+
|
546
|
+
</div>
|
547
|
+
</div>
|
548
|
+
<div class="tags">
|
549
|
+
<p class="tag_title">Parameters:</p>
|
550
|
+
<ul class="param">
|
551
|
+
|
552
|
+
<li>
|
553
|
+
|
554
|
+
<span class='name'>rational</span>
|
555
|
+
|
556
|
+
|
557
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
|
558
|
+
|
559
|
+
|
560
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
561
|
+
|
562
|
+
|
563
|
+
—
|
564
|
+
<div class='inline'><p>If to return the offset as a Rational.</p>
|
565
|
+
</div>
|
566
|
+
|
567
|
+
</li>
|
568
|
+
|
569
|
+
<li>
|
570
|
+
|
571
|
+
<span class='name'>date</span>
|
572
|
+
|
573
|
+
|
574
|
+
<span class='type'>(<tt><span class='object_link'><a href="DateTime.html" title="Lazier::DateTime (module)">DateTime</a></span></tt>)</span>
|
575
|
+
|
576
|
+
|
577
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
578
|
+
|
579
|
+
|
580
|
+
—
|
581
|
+
<div class='inline'><p>The date to consider. Defaults to now.</p>
|
582
|
+
</div>
|
583
|
+
|
584
|
+
</li>
|
585
|
+
|
586
|
+
</ul>
|
587
|
+
|
588
|
+
<p class="tag_title">Returns:</p>
|
589
|
+
<ul class="return">
|
590
|
+
|
591
|
+
<li>
|
592
|
+
|
593
|
+
|
594
|
+
<span class='type'>(<tt>Fixnum|Rational</tt>)</span>
|
595
|
+
|
596
|
+
|
597
|
+
|
598
|
+
—
|
599
|
+
<div class='inline'><p>The offset of this timezone.</p>
|
600
|
+
</div>
|
601
|
+
|
602
|
+
</li>
|
603
|
+
|
604
|
+
</ul>
|
605
|
+
|
606
|
+
</div><table class="source_code">
|
607
|
+
<tr>
|
608
|
+
<td>
|
609
|
+
<pre class="lines">
|
610
|
+
|
611
|
+
|
612
|
+
418
|
613
|
+
419
|
614
|
+
420
|
615
|
+
421
|
616
|
+
422
|
617
|
+
423
|
618
|
+
424
|
619
|
+
425</pre>
|
620
|
+
</td>
|
621
|
+
<td>
|
622
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 418</span>
|
623
|
+
|
624
|
+
<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>
|
625
|
+
<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>
|
626
|
+
|
627
|
+
<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>
|
628
|
+
|
629
|
+
<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>
|
630
|
+
<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>
|
631
|
+
<span class='kw'>end</span></pre>
|
632
|
+
</td>
|
633
|
+
</tr>
|
634
|
+
</table>
|
635
|
+
</div>
|
636
|
+
|
637
|
+
<div class="method_details ">
|
638
|
+
<h3 class="signature " id="dst_correction-instance_method">
|
639
|
+
|
640
|
+
- (<tt>Fixnum|Rational</tt>) <strong>dst_correction</strong>(rational = false, year = nil)
|
641
|
+
|
642
|
+
|
643
|
+
|
644
|
+
|
645
|
+
|
646
|
+
</h3><div class="docstring">
|
647
|
+
<div class="discussion">
|
648
|
+
<p>Return the correction applied to the standard offset the timezone when the Daylight Saving Time (DST) is active.</p>
|
649
|
+
|
650
|
+
|
651
|
+
</div>
|
652
|
+
</div>
|
653
|
+
<div class="tags">
|
654
|
+
<p class="tag_title">Parameters:</p>
|
655
|
+
<ul class="param">
|
656
|
+
|
657
|
+
<li>
|
658
|
+
|
659
|
+
<span class='name'>rational</span>
|
660
|
+
|
661
|
+
|
662
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
|
663
|
+
|
664
|
+
|
665
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
666
|
+
|
667
|
+
|
668
|
+
—
|
669
|
+
<div class='inline'><p>If to return the offset as a Rational.</p>
|
670
|
+
</div>
|
671
|
+
|
672
|
+
</li>
|
673
|
+
|
674
|
+
<li>
|
675
|
+
|
676
|
+
<span class='name'>year</span>
|
677
|
+
|
678
|
+
|
679
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
680
|
+
|
681
|
+
|
682
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
683
|
+
|
684
|
+
|
685
|
+
—
|
686
|
+
<div class='inline'><p>The year to which refer to. Defaults to the current year.</p>
|
687
|
+
</div>
|
688
|
+
|
689
|
+
</li>
|
690
|
+
|
691
|
+
</ul>
|
692
|
+
|
693
|
+
<p class="tag_title">Returns:</p>
|
694
|
+
<ul class="return">
|
695
|
+
|
696
|
+
<li>
|
697
|
+
|
698
|
+
|
699
|
+
<span class='type'>(<tt>Fixnum|Rational</tt>)</span>
|
700
|
+
|
701
|
+
|
702
|
+
|
703
|
+
—
|
704
|
+
<div class='inline'><p>The correction for dst.</p>
|
705
|
+
</div>
|
706
|
+
|
707
|
+
</li>
|
708
|
+
|
709
|
+
</ul>
|
710
|
+
|
711
|
+
</div><table class="source_code">
|
712
|
+
<tr>
|
713
|
+
<td>
|
714
|
+
<pre class="lines">
|
715
|
+
|
716
|
+
|
717
|
+
468
|
718
|
+
469
|
719
|
+
470
|
720
|
+
471
|
721
|
+
472</pre>
|
722
|
+
</td>
|
723
|
+
<td>
|
724
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 468</span>
|
725
|
+
|
726
|
+
<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>
|
727
|
+
<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>
|
728
|
+
<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>
|
729
|
+
<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>
|
730
|
+
<span class='kw'>end</span></pre>
|
731
|
+
</td>
|
732
|
+
</tr>
|
733
|
+
</table>
|
734
|
+
</div>
|
735
|
+
|
736
|
+
<div class="method_details ">
|
737
|
+
<h3 class="signature " id="dst_name-instance_method">
|
738
|
+
|
739
|
+
- (<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>) <strong>dst_name</strong>(dst_label = nil, year = nil, name = nil)
|
740
|
+
|
741
|
+
|
742
|
+
|
743
|
+
|
744
|
+
|
745
|
+
</h3><div class="docstring">
|
746
|
+
<div class="discussion">
|
747
|
+
<p>Returns the name for this zone with Daylight Saving Time (DST) active.</p>
|
748
|
+
|
749
|
+
|
750
|
+
</div>
|
751
|
+
</div>
|
752
|
+
<div class="tags">
|
753
|
+
<p class="tag_title">Parameters:</p>
|
754
|
+
<ul class="param">
|
755
|
+
|
756
|
+
<li>
|
757
|
+
|
758
|
+
<span class='name'>dst_label</span>
|
759
|
+
|
760
|
+
|
761
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
762
|
+
|
763
|
+
|
764
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
765
|
+
|
766
|
+
|
767
|
+
—
|
768
|
+
<div class='inline'><p>Label for the DST indication. Defaults to <code>(DST)</code>.</p>
|
769
|
+
</div>
|
770
|
+
|
771
|
+
</li>
|
772
|
+
|
773
|
+
<li>
|
774
|
+
|
775
|
+
<span class='name'>year</span>
|
776
|
+
|
777
|
+
|
778
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
779
|
+
|
780
|
+
|
781
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
782
|
+
|
783
|
+
|
784
|
+
—
|
785
|
+
<div class='inline'><p>The year to which refer to. Defaults to the current year.</p>
|
786
|
+
</div>
|
787
|
+
|
788
|
+
</li>
|
789
|
+
|
790
|
+
<li>
|
791
|
+
|
792
|
+
<span class='name'>name</span>
|
793
|
+
|
794
|
+
|
795
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
796
|
+
|
797
|
+
|
798
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
799
|
+
|
800
|
+
|
801
|
+
—
|
802
|
+
<div class='inline'><p>The name to use for this zone. Defaults to the zone name.</p>
|
803
|
+
</div>
|
804
|
+
|
805
|
+
</li>
|
806
|
+
|
807
|
+
</ul>
|
808
|
+
|
809
|
+
<p class="tag_title">Returns:</p>
|
810
|
+
<ul class="return">
|
811
|
+
|
812
|
+
<li>
|
813
|
+
|
814
|
+
|
815
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
816
|
+
|
817
|
+
|
818
|
+
|
819
|
+
—
|
820
|
+
<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>
|
821
|
+
</div>
|
822
|
+
|
823
|
+
</li>
|
824
|
+
|
825
|
+
</ul>
|
826
|
+
|
827
|
+
</div><table class="source_code">
|
828
|
+
<tr>
|
829
|
+
<td>
|
830
|
+
<pre class="lines">
|
831
|
+
|
832
|
+
|
833
|
+
491
|
834
|
+
492
|
835
|
+
493
|
836
|
+
494
|
837
|
+
495
|
838
|
+
496</pre>
|
839
|
+
</td>
|
840
|
+
<td>
|
841
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 491</span>
|
842
|
+
|
843
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_dst_name'>dst_name</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='comma'>,</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
844
|
+
<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'>(DST)</span><span class='tstring_end'>"</span></span>
|
845
|
+
<span class='id identifier rubyid_name'>name</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span>
|
846
|
+
|
847
|
+
<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='op'>?</span> <span class='tstring'><span class='tstring_beg'>"</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> <span class='op'>:</span> <span class='kw'>nil</span>
|
848
|
+
<span class='kw'>end</span></pre>
|
849
|
+
</td>
|
850
|
+
</tr>
|
851
|
+
</table>
|
852
|
+
</div>
|
853
|
+
|
854
|
+
<div class="method_details ">
|
855
|
+
<h3 class="signature " id="dst_offset-instance_method">
|
856
|
+
|
857
|
+
- (<tt>Fixnum|Rational</tt>) <strong>dst_offset</strong>(rational = false, year = nil)
|
858
|
+
|
859
|
+
|
860
|
+
|
861
|
+
|
862
|
+
|
863
|
+
</h3><div class="docstring">
|
864
|
+
<div class="discussion">
|
865
|
+
<p>Returns the standard offset for this timezone timezone when the Daylight Saving Time (DST) is active.</p>
|
866
|
+
|
867
|
+
|
868
|
+
</div>
|
869
|
+
</div>
|
870
|
+
<div class="tags">
|
871
|
+
<p class="tag_title">Parameters:</p>
|
872
|
+
<ul class="param">
|
873
|
+
|
874
|
+
<li>
|
875
|
+
|
876
|
+
<span class='name'>rational</span>
|
877
|
+
|
878
|
+
|
879
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
|
880
|
+
|
881
|
+
|
882
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
883
|
+
|
884
|
+
|
885
|
+
—
|
886
|
+
<div class='inline'><p>If to return the offset as a Rational.</p>
|
887
|
+
</div>
|
888
|
+
|
889
|
+
</li>
|
890
|
+
|
891
|
+
<li>
|
892
|
+
|
893
|
+
<span class='name'>year</span>
|
894
|
+
|
895
|
+
|
896
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
897
|
+
|
898
|
+
|
899
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
900
|
+
|
901
|
+
|
902
|
+
—
|
903
|
+
<div class='inline'><p>The year to which refer to. Defaults to the current year.</p>
|
904
|
+
</div>
|
905
|
+
|
906
|
+
</li>
|
907
|
+
|
908
|
+
</ul>
|
909
|
+
|
910
|
+
<p class="tag_title">Returns:</p>
|
911
|
+
<ul class="return">
|
912
|
+
|
913
|
+
<li>
|
914
|
+
|
915
|
+
|
916
|
+
<span class='type'>(<tt>Fixnum|Rational</tt>)</span>
|
917
|
+
|
918
|
+
|
919
|
+
|
920
|
+
—
|
921
|
+
<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>
|
922
|
+
</div>
|
923
|
+
|
924
|
+
</li>
|
925
|
+
|
926
|
+
</ul>
|
927
|
+
|
928
|
+
</div><table class="source_code">
|
929
|
+
<tr>
|
930
|
+
<td>
|
931
|
+
<pre class="lines">
|
932
|
+
|
933
|
+
|
934
|
+
479
|
935
|
+
480
|
936
|
+
481
|
937
|
+
482
|
938
|
+
483</pre>
|
939
|
+
</td>
|
940
|
+
<td>
|
941
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 479</span>
|
942
|
+
|
943
|
+
<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>
|
944
|
+
<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>
|
945
|
+
<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>
|
946
|
+
<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>
|
947
|
+
<span class='kw'>end</span></pre>
|
948
|
+
</td>
|
949
|
+
</tr>
|
950
|
+
</table>
|
951
|
+
</div>
|
952
|
+
|
953
|
+
<div class="method_details ">
|
954
|
+
<h3 class="signature " id="dst_period-instance_method">
|
955
|
+
|
956
|
+
- (<tt>TimezonePeriod</tt>) <strong>dst_period</strong>(year = nil)
|
957
|
+
|
958
|
+
|
959
|
+
|
960
|
+
|
961
|
+
|
962
|
+
</h3><div class="docstring">
|
963
|
+
<div class="discussion">
|
964
|
+
<p>Gets a period for this timezone when the Daylight Saving Time (DST) is active (it takes care of different hemispheres).</p>
|
965
|
+
|
966
|
+
|
967
|
+
</div>
|
968
|
+
</div>
|
969
|
+
<div class="tags">
|
970
|
+
<p class="tag_title">Parameters:</p>
|
971
|
+
<ul class="param">
|
972
|
+
|
973
|
+
<li>
|
974
|
+
|
975
|
+
<span class='name'>year</span>
|
976
|
+
|
977
|
+
|
978
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
979
|
+
|
980
|
+
|
981
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
982
|
+
|
983
|
+
|
984
|
+
—
|
985
|
+
<div class='inline'><p>The year to which refer to. Defaults to the current year.</p>
|
986
|
+
</div>
|
987
|
+
|
988
|
+
</li>
|
989
|
+
|
990
|
+
</ul>
|
991
|
+
|
992
|
+
<p class="tag_title">Returns:</p>
|
993
|
+
<ul class="return">
|
994
|
+
|
995
|
+
<li>
|
996
|
+
|
997
|
+
|
998
|
+
<span class='type'>(<tt>TimezonePeriod</tt>)</span>
|
999
|
+
|
1000
|
+
|
1001
|
+
|
1002
|
+
—
|
1003
|
+
<div class='inline'><p>A period when the Daylight Saving Time (DST) is active or <code>nil</code> if the timezone doesn't use DST for that year.</p>
|
1004
|
+
</div>
|
1005
|
+
|
1006
|
+
</li>
|
1007
|
+
|
1008
|
+
</ul>
|
1009
|
+
|
1010
|
+
</div><table class="source_code">
|
1011
|
+
<tr>
|
1012
|
+
<td>
|
1013
|
+
<pre class="lines">
|
1014
|
+
|
1015
|
+
|
1016
|
+
440
|
1017
|
+
441
|
1018
|
+
442
|
1019
|
+
443
|
1020
|
+
444
|
1021
|
+
445
|
1022
|
+
446
|
1023
|
+
447
|
1024
|
+
448
|
1025
|
+
449</pre>
|
1026
|
+
</td>
|
1027
|
+
<td>
|
1028
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 440</span>
|
1029
|
+
|
1030
|
+
<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>
|
1031
|
+
<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>
|
1032
|
+
|
1033
|
+
<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.
|
1034
|
+
</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.
|
1035
|
+
</span>
|
1036
|
+
<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>
|
1037
|
+
<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>
|
1038
|
+
<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>
|
1039
|
+
<span class='kw'>end</span></pre>
|
1040
|
+
</td>
|
1041
|
+
</tr>
|
1042
|
+
</table>
|
1043
|
+
</div>
|
1044
|
+
|
1045
|
+
<div class="method_details ">
|
1046
|
+
<h3 class="signature " id="offset-instance_method">
|
1047
|
+
|
1048
|
+
- (<tt>Fixnum|Rational</tt>) <strong>offset</strong>(rational = false)
|
1049
|
+
|
1050
|
+
|
1051
|
+
|
1052
|
+
|
1053
|
+
|
1054
|
+
</h3><div class="docstring">
|
1055
|
+
<div class="discussion">
|
1056
|
+
<p>Returns the standard offset for this timezone.</p>
|
1057
|
+
|
1058
|
+
|
1059
|
+
</div>
|
1060
|
+
</div>
|
1061
|
+
<div class="tags">
|
1062
|
+
<p class="tag_title">Parameters:</p>
|
1063
|
+
<ul class="param">
|
1064
|
+
|
1065
|
+
<li>
|
1066
|
+
|
1067
|
+
<span class='name'>rational</span>
|
1068
|
+
|
1069
|
+
|
1070
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
|
1071
|
+
|
1072
|
+
|
1073
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
1074
|
+
|
1075
|
+
|
1076
|
+
—
|
1077
|
+
<div class='inline'><p>If to return the offset as a Rational.</p>
|
1078
|
+
</div>
|
1079
|
+
|
1080
|
+
</li>
|
1081
|
+
|
1082
|
+
</ul>
|
1083
|
+
|
1084
|
+
<p class="tag_title">Returns:</p>
|
1085
|
+
<ul class="return">
|
1086
|
+
|
1087
|
+
<li>
|
1088
|
+
|
1089
|
+
|
1090
|
+
<span class='type'>(<tt>Fixnum|Rational</tt>)</span>
|
1091
|
+
|
1092
|
+
|
1093
|
+
|
1094
|
+
—
|
1095
|
+
<div class='inline'><p>The offset of this timezone.</p>
|
1096
|
+
</div>
|
1097
|
+
|
1098
|
+
</li>
|
1099
|
+
|
1100
|
+
</ul>
|
1101
|
+
|
1102
|
+
</div><table class="source_code">
|
1103
|
+
<tr>
|
1104
|
+
<td>
|
1105
|
+
<pre class="lines">
|
1106
|
+
|
1107
|
+
|
1108
|
+
431
|
1109
|
+
432
|
1110
|
+
433
|
1111
|
+
434</pre>
|
1112
|
+
</td>
|
1113
|
+
<td>
|
1114
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 431</span>
|
1115
|
+
|
1116
|
+
<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>
|
1117
|
+
<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>
|
1118
|
+
<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>
|
1119
|
+
<span class='kw'>end</span></pre>
|
1120
|
+
</td>
|
1121
|
+
</tr>
|
1122
|
+
</table>
|
1123
|
+
</div>
|
1124
|
+
|
1125
|
+
<div class="method_details ">
|
1126
|
+
<h3 class="signature " id="to_str-instance_method">
|
1127
|
+
|
1128
|
+
- (<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>) <strong>to_str</strong>(name = nil, colon = true)
|
1129
|
+
|
1130
|
+
|
1131
|
+
|
1132
|
+
|
1133
|
+
|
1134
|
+
</h3><div class="docstring">
|
1135
|
+
<div class="discussion">
|
1136
|
+
<p>Returns the name for this zone with Daylight Saving Time (DST) active.</p>
|
1137
|
+
|
1138
|
+
|
1139
|
+
</div>
|
1140
|
+
</div>
|
1141
|
+
<div class="tags">
|
1142
|
+
<p class="tag_title">Parameters:</p>
|
1143
|
+
<ul class="param">
|
1144
|
+
|
1145
|
+
<li>
|
1146
|
+
|
1147
|
+
<span class='name'>name</span>
|
1148
|
+
|
1149
|
+
|
1150
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
1151
|
+
|
1152
|
+
|
1153
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1154
|
+
|
1155
|
+
|
1156
|
+
—
|
1157
|
+
<div class='inline'><p>The name to use for this zone. Defaults to the zone name.</p>
|
1158
|
+
</div>
|
1159
|
+
|
1160
|
+
</li>
|
1161
|
+
|
1162
|
+
<li>
|
1163
|
+
|
1164
|
+
<span class='name'>colon</span>
|
1165
|
+
|
1166
|
+
|
1167
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
|
1168
|
+
|
1169
|
+
|
1170
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
1171
|
+
|
1172
|
+
|
1173
|
+
—
|
1174
|
+
<div class='inline'><p>If to put the colon in the output string.</p>
|
1175
|
+
</div>
|
1176
|
+
|
1177
|
+
</li>
|
1178
|
+
|
1179
|
+
</ul>
|
1180
|
+
|
1181
|
+
<p class="tag_title">Returns:</p>
|
1182
|
+
<ul class="return">
|
1183
|
+
|
1184
|
+
<li>
|
1185
|
+
|
1186
|
+
|
1187
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
1188
|
+
|
1189
|
+
|
1190
|
+
|
1191
|
+
—
|
1192
|
+
<div class='inline'><p>The name for this zone.</p>
|
1193
|
+
</div>
|
1194
|
+
|
1195
|
+
</li>
|
1196
|
+
|
1197
|
+
</ul>
|
1198
|
+
|
1199
|
+
</div><table class="source_code">
|
1200
|
+
<tr>
|
1201
|
+
<td>
|
1202
|
+
<pre class="lines">
|
1203
|
+
|
1204
|
+
|
1205
|
+
503
|
1206
|
+
504
|
1207
|
+
505
|
1208
|
+
506</pre>
|
1209
|
+
</td>
|
1210
|
+
<td>
|
1211
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 503</span>
|
1212
|
+
|
1213
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_str'>to_str</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_colon'>colon</span> <span class='op'>=</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
1214
|
+
<span class='id identifier rubyid_name'>name</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_aliases'>aliases</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
1215
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>(GMT</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_formatted_offset'>formatted_offset</span><span class='lparen'>(</span><span class='id identifier rubyid_colon'>colon</span><span class='rparen'>)</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_end'>"</span></span>
|
1216
|
+
<span class='kw'>end</span></pre>
|
1217
|
+
</td>
|
1218
|
+
</tr>
|
1219
|
+
</table>
|
1220
|
+
</div>
|
1221
|
+
|
1222
|
+
<div class="method_details ">
|
1223
|
+
<h3 class="signature " id="to_str_parameterized-instance_method">
|
1224
|
+
|
1225
|
+
- (<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>) <strong>to_str_parameterized</strong>(with_offset = true, name = nil)
|
1226
|
+
|
1227
|
+
|
1228
|
+
|
1229
|
+
|
1230
|
+
|
1231
|
+
</h3><div class="docstring">
|
1232
|
+
<div class="discussion">
|
1233
|
+
<p>Returns a parametized string representation for this zone.</p>
|
1234
|
+
|
1235
|
+
|
1236
|
+
</div>
|
1237
|
+
</div>
|
1238
|
+
<div class="tags">
|
1239
|
+
<p class="tag_title">Parameters:</p>
|
1240
|
+
<ul class="param">
|
1241
|
+
|
1242
|
+
<li>
|
1243
|
+
|
1244
|
+
<span class='name'>with_offset</span>
|
1245
|
+
|
1246
|
+
|
1247
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
|
1248
|
+
|
1249
|
+
|
1250
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
1251
|
+
|
1252
|
+
|
1253
|
+
—
|
1254
|
+
<div class='inline'><p>If to include offset into the representation.</p>
|
1255
|
+
</div>
|
1256
|
+
|
1257
|
+
</li>
|
1258
|
+
|
1259
|
+
<li>
|
1260
|
+
|
1261
|
+
<span class='name'>name</span>
|
1262
|
+
|
1263
|
+
|
1264
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
1265
|
+
|
1266
|
+
|
1267
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1268
|
+
|
1269
|
+
|
1270
|
+
—
|
1271
|
+
<div class='inline'><p>The name to use for this zone. Defaults to the zone name.</p>
|
1272
|
+
</div>
|
1273
|
+
|
1274
|
+
</li>
|
1275
|
+
|
1276
|
+
</ul>
|
1277
|
+
|
1278
|
+
<p class="tag_title">Returns:</p>
|
1279
|
+
<ul class="return">
|
1280
|
+
|
1281
|
+
<li>
|
1282
|
+
|
1283
|
+
|
1284
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
1285
|
+
|
1286
|
+
|
1287
|
+
|
1288
|
+
—
|
1289
|
+
<div class='inline'><p>The parametized string representation for this zone.</p>
|
1290
|
+
</div>
|
1291
|
+
|
1292
|
+
</li>
|
1293
|
+
|
1294
|
+
</ul>
|
1295
|
+
|
1296
|
+
</div><table class="source_code">
|
1297
|
+
<tr>
|
1298
|
+
<td>
|
1299
|
+
<pre class="lines">
|
1300
|
+
|
1301
|
+
|
1302
|
+
532
|
1303
|
+
533
|
1304
|
+
534</pre>
|
1305
|
+
</td>
|
1306
|
+
<td>
|
1307
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 532</span>
|
1308
|
+
|
1309
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_str_parameterized'>to_str_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='comma'>,</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1310
|
+
<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_name'>name</span> <span class='op'>||</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_str'>to_str</span><span class='comma'>,</span> <span class='id identifier rubyid_with_offset'>with_offset</span><span class='rparen'>)</span>
|
1311
|
+
<span class='kw'>end</span></pre>
|
1312
|
+
</td>
|
1313
|
+
</tr>
|
1314
|
+
</table>
|
1315
|
+
</div>
|
1316
|
+
|
1317
|
+
<div class="method_details ">
|
1318
|
+
<h3 class="signature " id="to_str_with_dst-instance_method">
|
1319
|
+
|
1320
|
+
- (<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>) <strong>to_str_with_dst</strong>(dst_label = nil, year = nil, name = nil)
|
1321
|
+
|
1322
|
+
|
1323
|
+
|
1324
|
+
|
1325
|
+
|
1326
|
+
</h3><div class="docstring">
|
1327
|
+
<div class="discussion">
|
1328
|
+
<p>Returns a string representation for this zone with Daylight Saving Time (DST) active.</p>
|
1329
|
+
|
1330
|
+
|
1331
|
+
</div>
|
1332
|
+
</div>
|
1333
|
+
<div class="tags">
|
1334
|
+
<p class="tag_title">Parameters:</p>
|
1335
|
+
<ul class="param">
|
1336
|
+
|
1337
|
+
<li>
|
1338
|
+
|
1339
|
+
<span class='name'>dst_label</span>
|
1340
|
+
|
1341
|
+
|
1342
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
1343
|
+
|
1344
|
+
|
1345
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1346
|
+
|
1347
|
+
|
1348
|
+
—
|
1349
|
+
<div class='inline'><p>Label for the DST indication. Defaults to <code>(DST)</code>.</p>
|
1350
|
+
</div>
|
1351
|
+
|
1352
|
+
</li>
|
1353
|
+
|
1354
|
+
<li>
|
1355
|
+
|
1356
|
+
<span class='name'>year</span>
|
1357
|
+
|
1358
|
+
|
1359
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
1360
|
+
|
1361
|
+
|
1362
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1363
|
+
|
1364
|
+
|
1365
|
+
—
|
1366
|
+
<div class='inline'><p>The year to which refer to. Defaults to the current year.</p>
|
1367
|
+
</div>
|
1368
|
+
|
1369
|
+
</li>
|
1370
|
+
|
1371
|
+
<li>
|
1372
|
+
|
1373
|
+
<span class='name'>name</span>
|
1374
|
+
|
1375
|
+
|
1376
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
1377
|
+
|
1378
|
+
|
1379
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1380
|
+
|
1381
|
+
|
1382
|
+
—
|
1383
|
+
<div class='inline'><p>The name to use for this zone. Defaults to the zone name.</p>
|
1384
|
+
</div>
|
1385
|
+
|
1386
|
+
</li>
|
1387
|
+
|
1388
|
+
</ul>
|
1389
|
+
|
1390
|
+
<p class="tag_title">Returns:</p>
|
1391
|
+
<ul class="return">
|
1392
|
+
|
1393
|
+
<li>
|
1394
|
+
|
1395
|
+
|
1396
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
1397
|
+
|
1398
|
+
|
1399
|
+
|
1400
|
+
—
|
1401
|
+
<div class='inline'><p>The string representation for the zone with DST or <code>nil</code>, if the timezone doesn't use DST for that year.</p>
|
1402
|
+
</div>
|
1403
|
+
|
1404
|
+
</li>
|
1405
|
+
|
1406
|
+
</ul>
|
1407
|
+
|
1408
|
+
</div><table class="source_code">
|
1409
|
+
<tr>
|
1410
|
+
<td>
|
1411
|
+
<pre class="lines">
|
1412
|
+
|
1413
|
+
|
1414
|
+
514
|
1415
|
+
515
|
1416
|
+
516
|
1417
|
+
517
|
1418
|
+
518
|
1419
|
+
519
|
1420
|
+
520
|
1421
|
+
521
|
1422
|
+
522
|
1423
|
+
523
|
1424
|
+
524
|
1425
|
+
525</pre>
|
1426
|
+
</td>
|
1427
|
+
<td>
|
1428
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 514</span>
|
1429
|
+
|
1430
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_str_with_dst'>to_str_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='comma'>,</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1431
|
+
<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'>(DST)</span><span class='tstring_end'>"</span></span>
|
1432
|
+
<span class='id identifier rubyid_name'>name</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_aliases'>aliases</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
1433
|
+
|
1434
|
+
<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>
|
1435
|
+
<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>
|
1436
|
+
<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>
|
1437
|
+
<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>
|
1438
|
+
<span class='kw'>else</span>
|
1439
|
+
<span class='kw'>nil</span>
|
1440
|
+
<span class='kw'>end</span>
|
1441
|
+
<span class='kw'>end</span></pre>
|
1442
|
+
</td>
|
1443
|
+
</tr>
|
1444
|
+
</table>
|
1445
|
+
</div>
|
1446
|
+
|
1447
|
+
<div class="method_details ">
|
1448
|
+
<h3 class="signature " id="to_str_with_dst_parameterized-instance_method">
|
1449
|
+
|
1450
|
+
- (<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>) <strong>to_str_with_dst_parameterized</strong>(dst_label = nil, with_offset = true, year = nil, name = nil)
|
1451
|
+
|
1452
|
+
|
1453
|
+
|
1454
|
+
|
1455
|
+
|
1456
|
+
</h3><div class="docstring">
|
1457
|
+
<div class="discussion">
|
1458
|
+
<p>Returns a parametized string representation for this zone with Daylight Saving Time (DST) active.</p>
|
1459
|
+
|
1460
|
+
|
1461
|
+
</div>
|
1462
|
+
</div>
|
1463
|
+
<div class="tags">
|
1464
|
+
<p class="tag_title">Parameters:</p>
|
1465
|
+
<ul class="param">
|
1466
|
+
|
1467
|
+
<li>
|
1468
|
+
|
1469
|
+
<span class='name'>dst_label</span>
|
1470
|
+
|
1471
|
+
|
1472
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
1473
|
+
|
1474
|
+
|
1475
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1476
|
+
|
1477
|
+
|
1478
|
+
—
|
1479
|
+
<div class='inline'><p>Label for the DST indication. Defaults to <code>(DST)</code>.</p>
|
1480
|
+
</div>
|
1481
|
+
|
1482
|
+
</li>
|
1483
|
+
|
1484
|
+
<li>
|
1485
|
+
|
1486
|
+
<span class='name'>with_offset</span>
|
1487
|
+
|
1488
|
+
|
1489
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
|
1490
|
+
|
1491
|
+
|
1492
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
1493
|
+
|
1494
|
+
|
1495
|
+
—
|
1496
|
+
<div class='inline'><p>If to include offset into the representation.</p>
|
1497
|
+
</div>
|
1498
|
+
|
1499
|
+
</li>
|
1500
|
+
|
1501
|
+
<li>
|
1502
|
+
|
1503
|
+
<span class='name'>year</span>
|
1504
|
+
|
1505
|
+
|
1506
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
1507
|
+
|
1508
|
+
|
1509
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1510
|
+
|
1511
|
+
|
1512
|
+
—
|
1513
|
+
<div class='inline'><p>The year to which refer to. Defaults to the current year.</p>
|
1514
|
+
</div>
|
1515
|
+
|
1516
|
+
</li>
|
1517
|
+
|
1518
|
+
<li>
|
1519
|
+
|
1520
|
+
<span class='name'>name</span>
|
1521
|
+
|
1522
|
+
|
1523
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
1524
|
+
|
1525
|
+
|
1526
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1527
|
+
|
1528
|
+
|
1529
|
+
—
|
1530
|
+
<div class='inline'><p>The name to use for this zone. Defaults to the zone name.</p>
|
1531
|
+
</div>
|
1532
|
+
|
1533
|
+
</li>
|
1534
|
+
|
1535
|
+
</ul>
|
1536
|
+
|
1537
|
+
<p class="tag_title">Returns:</p>
|
1538
|
+
<ul class="return">
|
1539
|
+
|
1540
|
+
<li>
|
1541
|
+
|
1542
|
+
|
1543
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
1544
|
+
|
1545
|
+
|
1546
|
+
|
1547
|
+
—
|
1548
|
+
<div class='inline'><p>The parametized string representation for this zone with DST or <code>nil</code>, if the timezone doesn't use DST for that year.</p>
|
1549
|
+
</div>
|
1550
|
+
|
1551
|
+
</li>
|
1552
|
+
|
1553
|
+
</ul>
|
1554
|
+
|
1555
|
+
</div><table class="source_code">
|
1556
|
+
<tr>
|
1557
|
+
<td>
|
1558
|
+
<pre class="lines">
|
1559
|
+
|
1560
|
+
|
1561
|
+
543
|
1562
|
+
544
|
1563
|
+
545
|
1564
|
+
546</pre>
|
1565
|
+
</td>
|
1566
|
+
<td>
|
1567
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 543</span>
|
1568
|
+
|
1569
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_str_with_dst_parameterized'>to_str_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='comma'>,</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1570
|
+
<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_str_with_dst'>to_str_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='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
1571
|
+
<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>
|
1572
|
+
<span class='kw'>end</span></pre>
|
1573
|
+
</td>
|
1574
|
+
</tr>
|
1575
|
+
</table>
|
1576
|
+
</div>
|
1577
|
+
|
1578
|
+
<div class="method_details ">
|
1579
|
+
<h3 class="signature " id="uses_dst?-instance_method">
|
1580
|
+
|
1581
|
+
- (<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>) <strong>uses_dst?</strong>(reference = nil)
|
1582
|
+
|
1583
|
+
|
1584
|
+
|
1585
|
+
|
1586
|
+
|
1587
|
+
</h3><div class="docstring">
|
1588
|
+
<div class="discussion">
|
1589
|
+
<p>Checks if the timezone uses Daylight Saving Time (DST) for that date or year.</p>
|
1590
|
+
|
1591
|
+
|
1592
|
+
</div>
|
1593
|
+
</div>
|
1594
|
+
<div class="tags">
|
1595
|
+
<p class="tag_title">Parameters:</p>
|
1596
|
+
<ul class="param">
|
1597
|
+
|
1598
|
+
<li>
|
1599
|
+
|
1600
|
+
<span class='name'>reference</span>
|
1601
|
+
|
1602
|
+
|
1603
|
+
<span class='type'>(<tt><span class='object_link'><a href="Object.html" title="Lazier::Object (module)">Object</a></span></tt>)</span>
|
1604
|
+
|
1605
|
+
|
1606
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1607
|
+
|
1608
|
+
|
1609
|
+
—
|
1610
|
+
<div class='inline'><p>The date or year to check. Defaults to the current year.</p>
|
1611
|
+
</div>
|
1612
|
+
|
1613
|
+
</li>
|
1614
|
+
|
1615
|
+
</ul>
|
1616
|
+
|
1617
|
+
<p class="tag_title">Returns:</p>
|
1618
|
+
<ul class="return">
|
1619
|
+
|
1620
|
+
<li>
|
1621
|
+
|
1622
|
+
|
1623
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
|
1624
|
+
|
1625
|
+
|
1626
|
+
|
1627
|
+
—
|
1628
|
+
<div class='inline'><p><code>true</code> if the zone uses DST for that date or year, <code>false</code> otherwise.</p>
|
1629
|
+
</div>
|
1630
|
+
|
1631
|
+
</li>
|
1632
|
+
|
1633
|
+
</ul>
|
1634
|
+
|
1635
|
+
</div><table class="source_code">
|
1636
|
+
<tr>
|
1637
|
+
<td>
|
1638
|
+
<pre class="lines">
|
1639
|
+
|
1640
|
+
|
1641
|
+
455
|
1642
|
+
456
|
1643
|
+
457
|
1644
|
+
458
|
1645
|
+
459
|
1646
|
+
460
|
1647
|
+
461</pre>
|
1648
|
+
</td>
|
1649
|
+
<td>
|
1650
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 455</span>
|
1651
|
+
|
1652
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_uses_dst?'>uses_dst?</span><span class='lparen'>(</span><span class='id identifier rubyid_reference'>reference</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1653
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_reference'>reference</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:year</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_reference'>reference</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:utc</span><span class='rparen'>)</span> <span class='kw'>then</span> <span class='comment'># This is a date like object
|
1654
|
+
</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_reference'>reference</span><span class='period'>.</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> <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_reference'>reference</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>
|
1655
|
+
<span class='kw'>else</span>
|
1656
|
+
<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_reference'>reference</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
1657
|
+
<span class='kw'>end</span>
|
1658
|
+
<span class='kw'>end</span></pre>
|
1659
|
+
</td>
|
1660
|
+
</tr>
|
1661
|
+
</table>
|
1662
|
+
</div>
|
1663
|
+
|
1664
|
+
</div>
|
1665
|
+
|
1666
|
+
</div>
|
1667
|
+
|
1668
|
+
<div id="footer">
|
1669
|
+
Generated on Wed Aug 1 08:57:56 2012 by
|
1670
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1671
|
+
0.8.2.1 (ruby-1.9.2).
|
1672
|
+
</div>
|
1673
|
+
|
1674
|
+
</body>
|
1675
|
+
</html>
|