lazier 3.5.7 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis-gemfile +5 -4
- data/.travis.yml +2 -2
- data/CHANGELOG.md +65 -8
- data/Gemfile +9 -8
- data/README.md +4 -0
- data/doc/Lazier.html +178 -110
- data/doc/Lazier/Boolean.html +7 -7
- data/doc/Lazier/Configuration.html +24 -50
- data/doc/Lazier/DateTime.html +50 -305
- data/doc/Lazier/DateTime/ClassMethods.html +116 -806
- data/doc/Lazier/Exceptions.html +2 -2
- data/doc/Lazier/Exceptions/Debug.html +1 -1
- data/doc/Lazier/Exceptions/MissingTranslation.html +18 -14
- data/doc/Lazier/Exceptions/TranslationExceptionHandler.html +213 -0
- data/doc/Lazier/Hash.html +19 -155
- data/doc/Lazier/I18n.html +1735 -230
- data/doc/Lazier/Math.html +1 -1
- data/doc/Lazier/Math/ClassMethods.html +13 -13
- data/doc/Lazier/Object.html +353 -339
- data/doc/Lazier/Pathname.html +4 -4
- data/doc/Lazier/Settings.html +150 -304
- data/doc/Lazier/String.html +39 -199
- data/doc/Lazier/TimeZone.html +244 -746
- data/doc/Lazier/TimeZone/ClassMethods.html +109 -127
- data/doc/Lazier/Version.html +4 -4
- data/doc/_index.html +15 -15
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +5 -1
- data/doc/index.html +5 -1
- data/doc/method_list.html +97 -169
- data/doc/top-level-namespace.html +1 -1
- data/lazier.gemspec +9 -6
- data/lib/lazier.rb +41 -50
- data/lib/lazier/boolean.rb +0 -1
- data/lib/lazier/configuration.rb +26 -28
- data/lib/lazier/datetime.rb +33 -127
- data/lib/lazier/exceptions.rb +14 -6
- data/lib/lazier/hash.rb +7 -15
- data/lib/lazier/i18n.rb +130 -48
- data/lib/lazier/math.rb +6 -7
- data/lib/lazier/object.rb +79 -97
- data/lib/lazier/pathname.rb +0 -1
- data/lib/lazier/settings.rb +12 -25
- data/lib/lazier/string.rb +17 -38
- data/lib/lazier/timezone.rb +168 -164
- data/lib/lazier/version.rb +3 -4
- data/locales/en.yml +52 -51
- data/locales/it.yml +51 -50
- data/spec/coverage_helper.rb +0 -1
- data/spec/lazier/boolean_spec.rb +2 -3
- data/spec/lazier/configuration_spec.rb +3 -5
- data/spec/lazier/datetime_spec.rb +34 -95
- data/spec/lazier/exceptions_spec.rb +25 -0
- data/spec/lazier/hash_spec.rb +0 -21
- data/spec/lazier/i18n_spec.rb +135 -51
- data/spec/lazier/math_spec.rb +0 -1
- data/spec/lazier/object_spec.rb +105 -100
- data/spec/lazier/pathname_spec.rb +0 -1
- data/spec/lazier/settings_spec.rb +25 -28
- data/spec/lazier/string_spec.rb +7 -20
- data/spec/lazier/timezone_spec.rb +101 -87
- data/spec/lazier_spec.rb +25 -8
- data/spec/spec_helper.rb +3 -2
- metadata +15 -44
- data/doc/Lazier/Localizer.html +0 -545
- data/lib/lazier/localizer.rb +0 -41
- data/spec/lazier/localizer_spec.rb +0 -45
data/doc/Lazier/Boolean.html
CHANGED
@@ -211,12 +211,12 @@
|
|
211
211
|
<pre class="lines">
|
212
212
|
|
213
213
|
|
214
|
+
14
|
214
215
|
15
|
215
|
-
16
|
216
|
-
17</pre>
|
216
|
+
16</pre>
|
217
217
|
</td>
|
218
218
|
<td>
|
219
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/boolean.rb', line
|
219
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/boolean.rb', line 14</span>
|
220
220
|
|
221
221
|
<span class='kw'>def</span> <span class='id identifier rubyid_to_i'>to_i</span>
|
222
222
|
<span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>TrueClass</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='int'>1</span> <span class='op'>:</span> <span class='int'>0</span>
|
@@ -268,12 +268,12 @@
|
|
268
268
|
<pre class="lines">
|
269
269
|
|
270
270
|
|
271
|
+
21
|
271
272
|
22
|
272
|
-
23
|
273
|
-
24</pre>
|
273
|
+
23</pre>
|
274
274
|
</td>
|
275
275
|
<td>
|
276
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/boolean.rb', line
|
276
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/boolean.rb', line 21</span>
|
277
277
|
|
278
278
|
<span class='kw'>def</span> <span class='id identifier rubyid_value'>value</span>
|
279
279
|
<span class='kw'>self</span>
|
@@ -288,7 +288,7 @@
|
|
288
288
|
</div>
|
289
289
|
|
290
290
|
<div id="footer">
|
291
|
-
Generated on
|
291
|
+
Generated on Sun Jun 1 15:50:06 2014 by
|
292
292
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
293
293
|
0.8.7.4 (ruby-2.1.2).
|
294
294
|
</div>
|
@@ -92,15 +92,11 @@
|
|
92
92
|
|
93
93
|
|
94
94
|
|
95
|
-
<dt class="r2">Includes:</dt>
|
96
|
-
<dd class="r2"><span class='object_link'><a href="I18n.html" title="Lazier::I18n (module)">I18n</a></span></dd>
|
97
|
-
|
98
|
-
|
99
95
|
|
100
96
|
|
101
97
|
|
102
|
-
<dt class="
|
103
|
-
<dd class="
|
98
|
+
<dt class="r2 last">Defined in:</dt>
|
99
|
+
<dd class="r2 last">lib/lazier/configuration.rb</dd>
|
104
100
|
|
105
101
|
</dl>
|
106
102
|
<div class="clear"></div>
|
@@ -121,11 +117,6 @@
|
|
121
117
|
|
122
118
|
|
123
119
|
|
124
|
-
<h2>Instance Attribute Summary</h2>
|
125
|
-
|
126
|
-
<h3 class="inherited">Attributes included from <span class='object_link'><a href="I18n.html" title="Lazier::I18n (module)">I18n</a></span></h3>
|
127
|
-
<p class="inherited"><span class='object_link'><a href="I18n.html#i18n_locale-instance_method" title="Lazier::I18n#i18n_locale (method)">#i18n_locale</a></span>, <span class='object_link'><a href="I18n.html#i18n_locales_path-instance_method" title="Lazier::I18n#i18n_locales_path (method)">#i18n_locales_path</a></span>, <span class='object_link'><a href="I18n.html#i18n_root-instance_method" title="Lazier::I18n#i18n_root (method)">#i18n_root</a></span></p>
|
128
|
-
|
129
120
|
|
130
121
|
|
131
122
|
<h2>
|
@@ -138,7 +129,7 @@
|
|
138
129
|
<li class="public ">
|
139
130
|
<span class="summary_signature">
|
140
131
|
|
141
|
-
<a href="#property-class_method" title="property (class method)">+ (Object) <strong>property</strong>(
|
132
|
+
<a href="#property-class_method" title="property (class method)">+ (Object) <strong>property</strong>(name, options = {}) </a>
|
142
133
|
|
143
134
|
|
144
135
|
|
@@ -196,17 +187,6 @@
|
|
196
187
|
|
197
188
|
|
198
189
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="I18n.html" title="Lazier::I18n (module)">I18n</a></span></h3>
|
208
|
-
<p class="inherited"><span class='object_link'><a href="I18n.html#i18n-instance_method" title="Lazier::I18n#i18n (method)">#i18n</a></span>, <span class='object_link'><a href="I18n.html#i18n%3D-instance_method" title="Lazier::I18n#i18n= (method)">#i18n=</a></span>, <span class='object_link'><a href="I18n.html#i18n_setup-instance_method" title="Lazier::I18n#i18n_setup (method)">#i18n_setup</a></span></p>
|
209
|
-
|
210
190
|
<div id="constructor_details" class="method_details_list">
|
211
191
|
<h2>Constructor Details</h2>
|
212
192
|
|
@@ -256,18 +236,16 @@
|
|
256
236
|
<pre class="lines">
|
257
237
|
|
258
238
|
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
19</pre>
|
239
|
+
12
|
240
|
+
13
|
241
|
+
14
|
242
|
+
15</pre>
|
264
243
|
</td>
|
265
244
|
<td>
|
266
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/configuration.rb', line
|
245
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/configuration.rb', line 12</span>
|
267
246
|
|
268
247
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_attributes'>attributes</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
269
|
-
<span class='ivar'>@
|
270
|
-
<span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:lazier</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
248
|
+
<span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
|
271
249
|
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_attributes'>attributes</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
272
250
|
<span class='kw'>end</span></pre>
|
273
251
|
</td>
|
@@ -285,7 +263,7 @@
|
|
285
263
|
<div class="method_details first">
|
286
264
|
<h3 class="signature first" id="property-class_method">
|
287
265
|
|
288
|
-
+ (<tt><span class='object_link'><a href="Object.html" title="Lazier::Object (module)">Object</a></span></tt>) <strong>property</strong>(
|
266
|
+
+ (<tt><span class='object_link'><a href="Object.html" title="Lazier::Object (module)">Object</a></span></tt>) <strong>property</strong>(name, options = {})
|
289
267
|
|
290
268
|
|
291
269
|
|
@@ -311,7 +289,7 @@ Options are as follows:</p>
|
|
311
289
|
|
312
290
|
<li>
|
313
291
|
|
314
|
-
<span class='name'>
|
292
|
+
<span class='name'>name</span>
|
315
293
|
|
316
294
|
|
317
295
|
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span>|Symbol</tt>)</span>
|
@@ -350,31 +328,27 @@ Options are as follows:</p>
|
|
350
328
|
<pre class="lines">
|
351
329
|
|
352
330
|
|
331
|
+
26
|
332
|
+
27
|
333
|
+
28
|
334
|
+
29
|
353
335
|
30
|
354
336
|
31
|
355
337
|
32
|
356
338
|
33
|
357
|
-
34
|
358
|
-
35
|
359
|
-
36
|
360
|
-
37
|
361
|
-
38
|
362
|
-
39
|
363
|
-
40</pre>
|
339
|
+
34</pre>
|
364
340
|
</td>
|
365
341
|
<td>
|
366
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/configuration.rb', line
|
342
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/configuration.rb', line 26</span>
|
367
343
|
|
368
|
-
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_property'>property</span><span class='lparen'>(</span><span class='id identifier
|
369
|
-
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier
|
344
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_property'>property</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
345
|
+
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
370
346
|
|
371
347
|
<span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:readonly</span><span class='rbracket'>]</span>
|
372
|
-
<span class='id identifier
|
373
|
-
<span class='
|
374
|
-
|
375
|
-
|
376
|
-
</span><span class='heredoc_end'> ACCESSOR
|
377
|
-
</span> <span class='kw'>end</span>
|
348
|
+
<span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='symbol'>:define_method</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid__'>_</span><span class='op'>|</span>
|
349
|
+
<span class='id identifier rubyid_assert_readonly_property!'>assert_readonly_property!</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
350
|
+
<span class='kw'>end</span>
|
351
|
+
<span class='kw'>end</span>
|
378
352
|
<span class='kw'>end</span></pre>
|
379
353
|
</td>
|
380
354
|
</tr>
|
@@ -386,7 +360,7 @@ Options are as follows:</p>
|
|
386
360
|
</div>
|
387
361
|
|
388
362
|
<div id="footer">
|
389
|
-
Generated on
|
363
|
+
Generated on Sun Jun 1 15:50:06 2014 by
|
390
364
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
391
365
|
0.8.7.4 (ruby-2.1.2).
|
392
366
|
</div>
|
data/doc/Lazier/DateTime.html
CHANGED
@@ -126,7 +126,7 @@
|
|
126
126
|
<li class="public ">
|
127
127
|
<span class="summary_signature">
|
128
128
|
|
129
|
-
<a href="#
|
129
|
+
<a href="#format-instance_method" title="#format (instance method)">- (String) <strong>format</strong>(format = nil, custom: true, change_time_zone: false) </a>
|
130
130
|
|
131
131
|
|
132
132
|
|
@@ -140,7 +140,7 @@
|
|
140
140
|
|
141
141
|
|
142
142
|
|
143
|
-
<span class="summary_desc"><div class='inline'><p>
|
143
|
+
<span class="summary_desc"><div class='inline'><p>Formats a datetime, eventually looking up also custom formats and/or moving to the current timezone.</p>
|
144
144
|
</div></span>
|
145
145
|
|
146
146
|
</li>
|
@@ -149,7 +149,7 @@
|
|
149
149
|
<li class="public ">
|
150
150
|
<span class="summary_signature">
|
151
151
|
|
152
|
-
<a href="#
|
152
|
+
<a href="#months_since_year-instance_method" title="#months_since_year (instance method)">- (Fixnum) <strong>months_since_year</strong>(base = nil) </a>
|
153
153
|
|
154
154
|
|
155
155
|
|
@@ -163,53 +163,7 @@
|
|
163
163
|
|
164
164
|
|
165
165
|
|
166
|
-
<span class="summary_desc"><div class='inline'><p>
|
167
|
-
</div></span>
|
168
|
-
|
169
|
-
</li>
|
170
|
-
|
171
|
-
|
172
|
-
<li class="public ">
|
173
|
-
<span class="summary_signature">
|
174
|
-
|
175
|
-
<a href="#local_strftime-instance_method" title="#local_strftime (instance method)">- (String) <strong>local_strftime</strong>(format = 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>Formats a datetime in the current timezone.</p>
|
190
|
-
</div></span>
|
191
|
-
|
192
|
-
</li>
|
193
|
-
|
194
|
-
|
195
|
-
<li class="public ">
|
196
|
-
<span class="summary_signature">
|
197
|
-
|
198
|
-
<a href="#lstrftime-instance_method" title="#lstrftime (instance method)">- (String) <strong>lstrftime</strong>(format = 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>Formats a datetime, looking up also custom formats.</p>
|
166
|
+
<span class="summary_desc"><div class='inline'><p>Returns the number of months passed between the beginning of the base year and the current date.</p>
|
213
167
|
</div></span>
|
214
168
|
|
215
169
|
</li>
|
@@ -235,29 +189,6 @@
|
|
235
189
|
<span class="summary_desc"><div class='inline'><p>Returns the current month number with leading 0.</p>
|
236
190
|
</div></span>
|
237
191
|
|
238
|
-
</li>
|
239
|
-
|
240
|
-
|
241
|
-
<li class="public ">
|
242
|
-
<span class="summary_signature">
|
243
|
-
|
244
|
-
<a href="#utc_time-instance_method" title="#utc_time (instance method)">- (UTC::Time) <strong>utc_time</strong> </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 UTC::Time representation of the current datetime.</p>
|
259
|
-
</div></span>
|
260
|
-
|
261
192
|
</li>
|
262
193
|
|
263
194
|
|
@@ -272,9 +203,9 @@
|
|
272
203
|
|
273
204
|
|
274
205
|
<div class="method_details first">
|
275
|
-
<h3 class="signature first" id="
|
206
|
+
<h3 class="signature first" id="format-instance_method">
|
276
207
|
|
277
|
-
- (<tt>
|
208
|
+
- (<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>) <strong>format</strong>(format = nil, custom: true, change_time_zone: false)
|
278
209
|
|
279
210
|
|
280
211
|
|
@@ -282,12 +213,7 @@
|
|
282
213
|
|
283
214
|
</h3><div class="docstring">
|
284
215
|
<div class="discussion">
|
285
|
-
<p>
|
286
|
-
|
287
|
-
<p><code>ruby
|
288
|
-
DateTime.civil(2013, 6, 1).in_months(2011)
|
289
|
-
# => 18
|
290
|
-
</code></p>
|
216
|
+
<p>Formats a datetime, eventually looking up also custom formats and/or moving to the current timezone.</p>
|
291
217
|
|
292
218
|
|
293
219
|
</div>
|
@@ -298,95 +224,47 @@ DateTime.civil(2013, 6, 1).in_months(2011)
|
|
298
224
|
|
299
225
|
<li>
|
300
226
|
|
301
|
-
<span class='name'>
|
227
|
+
<span class='name'>format</span>
|
302
228
|
|
303
229
|
|
304
|
-
<span class='type'>(<tt><span class='object_link'><a href="" title="Lazier::
|
230
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
305
231
|
|
306
232
|
|
307
233
|
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
308
234
|
|
309
235
|
|
310
236
|
—
|
311
|
-
<div class='inline'><p>
|
237
|
+
<div class='inline'><p>A format or a custom format name to use for formatting.</p>
|
312
238
|
</div>
|
313
239
|
|
314
240
|
</li>
|
315
241
|
|
316
|
-
</ul>
|
317
|
-
|
318
|
-
<p class="tag_title">Returns:</p>
|
319
|
-
<ul class="return">
|
320
|
-
|
321
242
|
<li>
|
322
243
|
|
244
|
+
<span class='name'>custom</span>
|
323
245
|
|
324
|
-
|
246
|
+
|
247
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
|
325
248
|
|
326
249
|
|
327
250
|
|
328
251
|
—
|
329
|
-
<div class='inline'><p>
|
252
|
+
<div class='inline'><p>Whether to use custom formats.</p>
|
330
253
|
</div>
|
331
254
|
|
332
255
|
</li>
|
333
256
|
|
334
|
-
</ul>
|
335
|
-
|
336
|
-
</div><table class="source_code">
|
337
|
-
<tr>
|
338
|
-
<td>
|
339
|
-
<pre class="lines">
|
340
|
-
|
341
|
-
|
342
|
-
227
|
343
|
-
228
|
344
|
-
229</pre>
|
345
|
-
</td>
|
346
|
-
<td>
|
347
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 227</span>
|
348
|
-
|
349
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_in_months'>in_months</span><span class='lparen'>(</span><span class='id identifier rubyid_base'>base</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
350
|
-
<span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span> <span class='op'>-</span> <span class='lparen'>(</span><span class='id identifier rubyid_base'>base</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><span class='rparen'>)</span><span class='rparen'>)</span> <span class='op'>*</span> <span class='int'>12</span> <span class='op'>+</span> <span class='id identifier rubyid_month'>month</span>
|
351
|
-
<span class='kw'>end</span></pre>
|
352
|
-
</td>
|
353
|
-
</tr>
|
354
|
-
</table>
|
355
|
-
</div>
|
356
|
-
|
357
|
-
<div class="method_details ">
|
358
|
-
<h3 class="signature " id="local_lstrftime-instance_method">
|
359
|
-
|
360
|
-
- (<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>) <strong>local_lstrftime</strong>(format = nil)
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
</h3><div class="docstring">
|
367
|
-
<div class="discussion">
|
368
|
-
<p>Formats a datetime in the current timezone, looking up also custom formats.</p>
|
369
|
-
|
370
|
-
|
371
|
-
</div>
|
372
|
-
</div>
|
373
|
-
<div class="tags">
|
374
|
-
<p class="tag_title">Parameters:</p>
|
375
|
-
<ul class="param">
|
376
|
-
|
377
257
|
<li>
|
378
258
|
|
379
|
-
<span class='name'>
|
380
|
-
|
259
|
+
<span class='name'>change_time_zone</span>
|
381
260
|
|
382
|
-
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
383
261
|
|
262
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
|
384
263
|
|
385
|
-
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
386
264
|
|
387
265
|
|
388
266
|
—
|
389
|
-
<div class='inline'><p>
|
267
|
+
<div class='inline'><p>Whether to move the date to the current timezone.</p>
|
390
268
|
</div>
|
391
269
|
|
392
270
|
</li>
|
@@ -424,15 +302,19 @@ DateTime.civil(2013, 6, 1).in_months(2011)
|
|
424
302
|
<pre class="lines">
|
425
303
|
|
426
304
|
|
427
|
-
|
428
|
-
|
429
|
-
|
305
|
+
166
|
306
|
+
167
|
307
|
+
168
|
308
|
+
169
|
309
|
+
170</pre>
|
430
310
|
</td>
|
431
311
|
<td>
|
432
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line
|
312
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 166</span>
|
433
313
|
|
434
|
-
<span class='kw'>def</span> <span class='id identifier
|
435
|
-
<span class='
|
314
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_format'>format</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>custom:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>change_time_zone:</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
315
|
+
<span class='id identifier rubyid_target'>target</span> <span class='op'>=</span> <span class='id identifier rubyid_change_time_zone'>change_time_zone</span> <span class='op'>&&</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:in_time_zone</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_in_time_zone'>in_time_zone</span> <span class='op'>:</span> <span class='kw'>self</span>
|
316
|
+
<span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='id identifier rubyid_custom'>custom</span> <span class='op'>?</span> <span class='op'>::</span><span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_custom_format'>custom_format</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</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'>(?<!%)(%[ab])</span><span class='regexp_end'>/i</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_mo'>mo</span><span class='op'>|</span> <span class='id identifier rubyid_localize_time_component'>localize_time_component</span><span class='lparen'>(</span><span class='id identifier rubyid_mo'>mo</span><span class='rparen'>)</span> <span class='rbrace'>}</span> <span class='op'>:</span> <span class='id identifier rubyid_format'>format</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
317
|
+
<span class='id identifier rubyid_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_strftime'>strftime</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span><span class='rparen'>)</span>
|
436
318
|
<span class='kw'>end</span></pre>
|
437
319
|
</td>
|
438
320
|
</tr>
|
@@ -440,9 +322,9 @@ DateTime.civil(2013, 6, 1).in_months(2011)
|
|
440
322
|
</div>
|
441
323
|
|
442
324
|
<div class="method_details ">
|
443
|
-
<h3 class="signature " id="
|
325
|
+
<h3 class="signature " id="months_since_year-instance_method">
|
444
326
|
|
445
|
-
- (<tt
|
327
|
+
- (<tt>Fixnum</tt>) <strong>months_since_year</strong>(base = nil)
|
446
328
|
|
447
329
|
|
448
330
|
|
@@ -450,85 +332,12 @@ DateTime.civil(2013, 6, 1).in_months(2011)
|
|
450
332
|
|
451
333
|
</h3><div class="docstring">
|
452
334
|
<div class="discussion">
|
453
|
-
<p>
|
454
|
-
|
455
|
-
|
456
|
-
</div>
|
457
|
-
</div>
|
458
|
-
<div class="tags">
|
459
|
-
<p class="tag_title">Parameters:</p>
|
460
|
-
<ul class="param">
|
461
|
-
|
462
|
-
<li>
|
463
|
-
|
464
|
-
<span class='name'>format</span>
|
465
|
-
|
466
|
-
|
467
|
-
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
468
|
-
|
469
|
-
|
470
|
-
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
471
|
-
|
472
|
-
|
473
|
-
—
|
474
|
-
<div class='inline'><p>The format to use for formatting.</p>
|
475
|
-
</div>
|
476
|
-
|
477
|
-
</li>
|
478
|
-
|
479
|
-
</ul>
|
480
|
-
|
481
|
-
<p class="tag_title">Returns:</p>
|
482
|
-
<ul class="return">
|
483
|
-
|
484
|
-
<li>
|
485
|
-
|
486
|
-
|
487
|
-
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
—
|
492
|
-
<div class='inline'><p>The formatted date.</p>
|
493
|
-
</div>
|
494
|
-
|
495
|
-
</li>
|
496
|
-
|
497
|
-
</ul>
|
498
|
-
|
499
|
-
</div><table class="source_code">
|
500
|
-
<tr>
|
501
|
-
<td>
|
502
|
-
<pre class="lines">
|
503
|
-
|
504
|
-
|
505
|
-
251
|
506
|
-
252
|
507
|
-
253</pre>
|
508
|
-
</td>
|
509
|
-
<td>
|
510
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 251</span>
|
511
|
-
|
512
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_local_strftime'>local_strftime</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
513
|
-
<span class='lparen'>(</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:in_time_zone</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_in_time_zone'>in_time_zone</span> <span class='op'>:</span> <span class='kw'>self</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_strftime'>strftime</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_custom_format'>custom_format</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
514
|
-
<span class='kw'>end</span></pre>
|
515
|
-
</td>
|
516
|
-
</tr>
|
517
|
-
</table>
|
518
|
-
</div>
|
519
|
-
|
520
|
-
<div class="method_details ">
|
521
|
-
<h3 class="signature " id="lstrftime-instance_method">
|
522
|
-
|
523
|
-
- (<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>) <strong>lstrftime</strong>(format = nil)
|
524
|
-
|
525
|
-
|
526
|
-
|
335
|
+
<p>Returns the number of months passed between the beginning of the base year and the current date.</p>
|
527
336
|
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
337
|
+
<p><code>ruby
|
338
|
+
DateTime.civil(2013, 6, 1).in_months(2011)
|
339
|
+
# => 18
|
340
|
+
</code></p>
|
532
341
|
|
533
342
|
|
534
343
|
</div>
|
@@ -539,17 +348,17 @@ DateTime.civil(2013, 6, 1).in_months(2011)
|
|
539
348
|
|
540
349
|
<li>
|
541
350
|
|
542
|
-
<span class='name'>
|
351
|
+
<span class='name'>base</span>
|
543
352
|
|
544
353
|
|
545
|
-
<span class='type'>(<tt><span class='object_link'><a href="
|
354
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="Lazier::DateTime (module)">DateTime</a></span></tt>)</span>
|
546
355
|
|
547
356
|
|
548
357
|
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
549
358
|
|
550
359
|
|
551
360
|
—
|
552
|
-
<div class='inline'><p>
|
361
|
+
<div class='inline'><p>The base year to start computation from. Default to current year.</p>
|
553
362
|
</div>
|
554
363
|
|
555
364
|
</li>
|
@@ -562,40 +371,33 @@ DateTime.civil(2013, 6, 1).in_months(2011)
|
|
562
371
|
<li>
|
563
372
|
|
564
373
|
|
565
|
-
<span class='type'>(<tt
|
374
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
566
375
|
|
567
376
|
|
568
377
|
|
569
378
|
—
|
570
|
-
<div class='inline'><p>
|
379
|
+
<div class='inline'><p>Returns the number of months passed between the beginning of the base year and the current date.</p>
|
571
380
|
</div>
|
572
381
|
|
573
382
|
</li>
|
574
383
|
|
575
384
|
</ul>
|
576
385
|
|
577
|
-
<p class="tag_title">See Also:</p>
|
578
|
-
<ul class="see">
|
579
|
-
|
580
|
-
<li><span class='object_link'><a href="Settings.html#setup_date_formats-instance_method" title="Lazier::Settings#setup_date_formats (method)">Settings#setup_date_formats</a></span></li>
|
581
|
-
|
582
|
-
</ul>
|
583
|
-
|
584
386
|
</div><table class="source_code">
|
585
387
|
<tr>
|
586
388
|
<td>
|
587
389
|
<pre class="lines">
|
588
390
|
|
589
391
|
|
590
|
-
|
591
|
-
|
592
|
-
|
392
|
+
148
|
393
|
+
149
|
394
|
+
150</pre>
|
593
395
|
</td>
|
594
396
|
<td>
|
595
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line
|
397
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 148</span>
|
596
398
|
|
597
|
-
<span class='kw'>def</span> <span class='id identifier
|
598
|
-
<span class='
|
399
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_months_since_year'>months_since_year</span><span class='lparen'>(</span><span class='id identifier rubyid_base'>base</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
400
|
+
<span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span> <span class='op'>-</span> <span class='lparen'>(</span><span class='id identifier rubyid_base'>base</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><span class='rparen'>)</span><span class='rparen'>)</span> <span class='op'>*</span> <span class='int'>12</span> <span class='op'>+</span> <span class='id identifier rubyid_month'>month</span>
|
599
401
|
<span class='kw'>end</span></pre>
|
600
402
|
</td>
|
601
403
|
</tr>
|
@@ -644,12 +446,12 @@ DateTime.civil(2013, 6, 1).in_months(2011)
|
|
644
446
|
<pre class="lines">
|
645
447
|
|
646
448
|
|
647
|
-
|
648
|
-
|
649
|
-
|
449
|
+
155
|
450
|
+
156
|
451
|
+
157</pre>
|
650
452
|
</td>
|
651
453
|
<td>
|
652
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line
|
454
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 155</span>
|
653
455
|
|
654
456
|
<span class='kw'>def</span> <span class='id identifier rubyid_padded_month'>padded_month</span>
|
655
457
|
<span class='id identifier rubyid_month'>month</span><span class='period'>.</span><span class='id identifier rubyid_indexize'>indexize</span>
|
@@ -657,63 +459,6 @@ DateTime.civil(2013, 6, 1).in_months(2011)
|
|
657
459
|
</td>
|
658
460
|
</tr>
|
659
461
|
</table>
|
660
|
-
</div>
|
661
|
-
|
662
|
-
<div class="method_details ">
|
663
|
-
<h3 class="signature " id="utc_time-instance_method">
|
664
|
-
|
665
|
-
- (<tt>UTC::Time</tt>) <strong>utc_time</strong>
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
</h3><div class="docstring">
|
672
|
-
<div class="discussion">
|
673
|
-
<p>Returns the UTC::Time representation of the current datetime.</p>
|
674
|
-
|
675
|
-
|
676
|
-
</div>
|
677
|
-
</div>
|
678
|
-
<div class="tags">
|
679
|
-
|
680
|
-
<p class="tag_title">Returns:</p>
|
681
|
-
<ul class="return">
|
682
|
-
|
683
|
-
<li>
|
684
|
-
|
685
|
-
|
686
|
-
<span class='type'>(<tt>UTC::Time</tt>)</span>
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
—
|
691
|
-
<div class='inline'><p>The UTC::Time representation of the current datetime.</p>
|
692
|
-
</div>
|
693
|
-
|
694
|
-
</li>
|
695
|
-
|
696
|
-
</ul>
|
697
|
-
|
698
|
-
</div><table class="source_code">
|
699
|
-
<tr>
|
700
|
-
<td>
|
701
|
-
<pre class="lines">
|
702
|
-
|
703
|
-
|
704
|
-
214
|
705
|
-
215
|
706
|
-
216</pre>
|
707
|
-
</td>
|
708
|
-
<td>
|
709
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 214</span>
|
710
|
-
|
711
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_utc_time'>utc_time</span>
|
712
|
-
<span class='id identifier rubyid_utc'>utc</span><span class='period'>.</span><span class='id identifier rubyid_to_time'>to_time</span>
|
713
|
-
<span class='kw'>end</span></pre>
|
714
|
-
</td>
|
715
|
-
</tr>
|
716
|
-
</table>
|
717
462
|
</div>
|
718
463
|
|
719
464
|
</div>
|
@@ -721,7 +466,7 @@ DateTime.civil(2013, 6, 1).in_months(2011)
|
|
721
466
|
</div>
|
722
467
|
|
723
468
|
<div id="footer">
|
724
|
-
Generated on
|
469
|
+
Generated on Sun Jun 1 15:50:06 2014 by
|
725
470
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
726
471
|
0.8.7.4 (ruby-2.1.2).
|
727
472
|
</div>
|