cowtech-extensions 2.6.0 → 2.7.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/doc/Cowtech.html +1 -1
- data/doc/Cowtech/Extensions.html +1 -1
- data/doc/Cowtech/Extensions/Boolean.html +1 -1
- data/doc/Cowtech/Extensions/DateTime.html +1 -1
- data/doc/Cowtech/Extensions/DateTime/ClassMethods.html +4 -4
- data/doc/Cowtech/Extensions/Exceptions.html +1 -1
- data/doc/Cowtech/Extensions/Exceptions/Dump.html +1 -1
- data/doc/Cowtech/Extensions/Hash.html +1 -1
- data/doc/Cowtech/Extensions/Math.html +1 -1
- data/doc/Cowtech/Extensions/Math/ClassMethods.html +1 -1
- data/doc/Cowtech/Extensions/Object.html +1 -1
- data/doc/Cowtech/Extensions/Pathname.html +1 -1
- data/doc/Cowtech/Extensions/Settings.html +1 -1
- data/doc/Cowtech/Extensions/String.html +1 -1
- data/doc/Cowtech/Extensions/TimeZone.html +445 -110
- data/doc/Cowtech/Extensions/TimeZone/ClassMethods.html +165 -35
- data/doc/Cowtech/Extensions/Version.html +1 -1
- data/doc/_index.html +1 -1
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/doc/method_list.html +38 -14
- data/doc/top-level-namespace.html +1 -1
- data/lib/cowtech-extensions/datetime.rb +95 -33
- data/lib/cowtech-extensions/version.rb +1 -1
- data/spec/cowtech-extensions/datetime_spec.rb +33 -30
- metadata +2 -2
@@ -103,7 +103,7 @@
|
|
103
103
|
</div>
|
104
104
|
|
105
105
|
<div id="footer">
|
106
|
-
Generated on
|
106
|
+
Generated on Tue Jul 24 12:12:52 2012 by
|
107
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
108
|
0.8.2.1 (ruby-1.9.2).
|
109
109
|
</div>
|
@@ -70,7 +70,7 @@ module Cowtech
|
|
70
70
|
# Returns a list of names of all timezones.
|
71
71
|
#
|
72
72
|
# @param with_dst [Boolean] If include DST version of the zones.
|
73
|
-
# @param dst_label [String] Label for the DST indication. Defaults to `(
|
73
|
+
# @param dst_label [String] Label for the DST indication. Defaults to `(DST)`.
|
74
74
|
# @return [Array] A list of names of timezones.
|
75
75
|
def list_timezones(with_dst = true, dst_label = nil)
|
76
76
|
::ActiveSupport::TimeZone.list_all(with_dst, dst_label)
|
@@ -79,7 +79,7 @@ module Cowtech
|
|
79
79
|
# Find a zone by its name.
|
80
80
|
#
|
81
81
|
# @param name [String] The zone name.
|
82
|
-
# @param dst_label [String] Label for the DST indication. Defaults to `(
|
82
|
+
# @param dst_label [String] Label for the DST indication. Defaults to `(DST)`.
|
83
83
|
# @return [TimeZone] A timezone or `nil` if no zone was found.
|
84
84
|
def find_timezone(name = true, dst_label = nil)
|
85
85
|
::ActiveSupport::TimeZone.find(name, dst_label)
|
@@ -103,7 +103,7 @@ module Cowtech
|
|
103
103
|
#
|
104
104
|
# @param tz [String] The zone to unparameterize.
|
105
105
|
# @param as_string [Boolean] If return just the zone name.
|
106
|
-
# @param dst_label [String] Label for the DST indication. Defaults to `(
|
106
|
+
# @param dst_label [String] Label for the DST indication. Defaults to `(DST)`.
|
107
107
|
# @return [String|TimeZone] The found timezone or `nil` if the zone is not valid.
|
108
108
|
def unparameterize_zone(tz, as_string = false, dst_label = nil)
|
109
109
|
::ActiveSupport::TimeZone::unparameterize_zone(tz, as_string, dst_label)
|
@@ -285,12 +285,14 @@ module Cowtech
|
|
285
285
|
# Find a zone by its name.
|
286
286
|
#
|
287
287
|
# @param name [String] The zone name.
|
288
|
-
# @param dst_label [String] Label for the DST indication. Defaults to `(
|
288
|
+
# @param dst_label [String] Label for the DST indication. Defaults to `(DST)`.
|
289
289
|
# @return [TimeZone] A timezone or `nil` if no zone was found.
|
290
290
|
def find(name, dst_label = nil)
|
291
291
|
catch(:zone) do
|
292
292
|
::ActiveSupport::TimeZone.all.each do |zone|
|
293
|
-
|
293
|
+
zone.aliases.each do |zone_alias|
|
294
|
+
throw(:zone, zone) if [zone.to_str(zone_alias), zone.to_str_with_dst(dst_label, nil, zone_alias)].include?(name)
|
295
|
+
end
|
294
296
|
end
|
295
297
|
|
296
298
|
nil
|
@@ -300,19 +302,24 @@ module Cowtech
|
|
300
302
|
# Returns a list of names of all timezones.
|
301
303
|
#
|
302
304
|
# @param with_dst [Boolean] If include DST version of the zones.
|
303
|
-
# @param dst_label [String] Label for the DST indication. Defaults to `(
|
305
|
+
# @param dst_label [String] Label for the DST indication. Defaults to `(DST)`.
|
304
306
|
# @return [Array] A list of names of timezones.
|
305
307
|
def list_all(with_dst = true, dst_label = nil)
|
308
|
+
dst_label ||= "(DST)"
|
306
309
|
dst_key = "DST-#{dst_label}"
|
307
|
-
@zones_names ||= { "STANDARD" => ActiveSupport::TimeZone.all.collect(&:to_s) }
|
310
|
+
@zones_names ||= { "STANDARD" => ::ActiveSupport::TimeZone.all.collect(&:to_s) }
|
308
311
|
|
309
312
|
if with_dst && @zones_names[dst_key].blank? then
|
310
313
|
@zones_names[dst_key] = []
|
311
314
|
|
312
315
|
::ActiveSupport::TimeZone.all.each do |zone|
|
313
|
-
|
314
|
-
|
316
|
+
zone.aliases.each do |zone_alias|
|
317
|
+
@zones_names[dst_key] << zone.to_str(zone_alias)
|
318
|
+
@zones_names[dst_key] << zone.to_str_with_dst(dst_label, nil, zone_alias) if zone.uses_dst? && zone_alias !~ /(#{Regexp.quote(dst_label)})$/
|
319
|
+
end
|
315
320
|
end
|
321
|
+
|
322
|
+
@zones_names[dst_key]= @zones_names[dst_key].uniq.compact.sort { |a,b| ::ActiveSupport::TimeZone.compare(a, b) } # Sort by name
|
316
323
|
end
|
317
324
|
|
318
325
|
@zones_names[with_dst ? dst_key : "STANDARD"]
|
@@ -344,14 +351,13 @@ module Cowtech
|
|
344
351
|
#
|
345
352
|
# @param tz [String] The zone to unparameterize.
|
346
353
|
# @param as_string [Boolean] If return just the zone name.
|
347
|
-
# @param dst_label [String] Label for the DST indication. Defaults to `(
|
354
|
+
# @param dst_label [String] Label for the DST indication. Defaults to `(DST)`.
|
348
355
|
# @return [String|TimeZone] The found timezone or `nil` if the zone is not valid.
|
349
356
|
def unparameterize_zone(tz, as_string = false, dst_label = nil)
|
350
357
|
tz = self.parameterize_zone(tz, false)
|
351
|
-
|
352
358
|
rv = catch(:zone) do
|
353
359
|
self.list_all(true, dst_label).each do |zone|
|
354
|
-
throw(:zone, zone) if self.parameterize_zone(zone, false)
|
360
|
+
throw(:zone, zone) if self.parameterize_zone(zone, false) =~ /(#{Regexp.quote(tz)})$/
|
355
361
|
end
|
356
362
|
|
357
363
|
nil
|
@@ -363,9 +369,49 @@ module Cowtech
|
|
363
369
|
nil
|
364
370
|
end
|
365
371
|
end
|
372
|
+
|
373
|
+
# Compares two timezones. They are sorted by the location name.
|
374
|
+
#
|
375
|
+
# @param left [String|TimeZone] The first zone name to compare.
|
376
|
+
# @param right [String|TimeZone] The second zone name to compare.
|
377
|
+
# @return [Fixnum] The result of comparison, like Ruby's operator `<=>`.
|
378
|
+
def compare(left, right)
|
379
|
+
left = left.to_str if left.is_a?(::ActiveSupport::TimeZone)
|
380
|
+
right = right.to_str if right.is_a?(::ActiveSupport::TimeZone)
|
381
|
+
left.ensure_string.split(" ", 2)[1] <=> right.ensure_string.split(" ", 2)[1]
|
382
|
+
end
|
383
|
+
end
|
384
|
+
|
385
|
+
# Returns a list of valid aliases (city names) for this timezone (basing on offset).
|
386
|
+
#
|
387
|
+
# @param dst_label [String] Label for the DST indication. Defaults to `(DST)`.
|
388
|
+
# @return [Array] A list of aliases for this timezone
|
389
|
+
def aliases(dst_label = nil)
|
390
|
+
reference = self.name
|
391
|
+
reference = self.class::MAPPING[self.name] if self.class::MAPPING.has_key?(self.name) # We are an alias
|
392
|
+
reference = reference.gsub("_", " ")
|
393
|
+
|
394
|
+
if @aliases.blank? then
|
395
|
+
# First we search for aliases by name
|
396
|
+
@aliases = [reference]
|
397
|
+
|
398
|
+
self.class::MAPPING.each do |name, zone|
|
399
|
+
if zone.gsub("_", " ") == reference then
|
400
|
+
if name == "International Date Line West" || name == "UTC" || name.include?("(US & Canada)")
|
401
|
+
@aliases << name
|
402
|
+
else
|
403
|
+
@aliases << reference.gsub(/\/.*/, "/" + name)
|
404
|
+
end
|
405
|
+
end
|
406
|
+
end
|
407
|
+
|
408
|
+
@aliases = @aliases.uniq.compact.sort
|
409
|
+
end
|
410
|
+
|
411
|
+
@aliases
|
366
412
|
end
|
367
413
|
|
368
|
-
# Returns the current offset for this timezone, taking care of DST (
|
414
|
+
# Returns the current offset for this timezone, taking care of DST (DST).
|
369
415
|
#
|
370
416
|
# @param rational [Boolean] If to return the offset as a Rational.
|
371
417
|
# @param date [DateTime] The date to consider. Defaults to now.
|
@@ -388,10 +434,10 @@ module Cowtech
|
|
388
434
|
rational ? self.class.rationalize_offset(rv) : rv
|
389
435
|
end
|
390
436
|
|
391
|
-
# Gets a period for this timezone when the DST (
|
437
|
+
# Gets a period for this timezone when the DST (DST) is active (it takes care of different hemispheres).
|
392
438
|
#
|
393
439
|
# @param year [Fixnum] The year to which refer to. Defaults to the current year.
|
394
|
-
# @return [TimezonePeriod] A period when the DST (
|
440
|
+
# @return [TimezonePeriod] A period when the DST (DST) is active or `nil` if the timezone doesn't use DST for that year.
|
395
441
|
def dst_period(year = nil)
|
396
442
|
year ||= ::Date.today.year
|
397
443
|
|
@@ -403,7 +449,7 @@ module Cowtech
|
|
403
449
|
period.dst? ? period : nil
|
404
450
|
end
|
405
451
|
|
406
|
-
# Checks if the timezone uses DST (
|
452
|
+
# Checks if the timezone uses DST (DST) for that year.
|
407
453
|
#
|
408
454
|
# @param year [Fixnum] The year to check. Defaults to the current year.
|
409
455
|
# @return [Boolean] `true` if the zone uses DST, `false` otherwise.
|
@@ -411,7 +457,7 @@ module Cowtech
|
|
411
457
|
self.dst_period(year).present?
|
412
458
|
end
|
413
459
|
|
414
|
-
# Return the correction applied to the standard offset the timezone when the DST (
|
460
|
+
# Return the correction applied to the standard offset the timezone when the DST (DST) is active.
|
415
461
|
#
|
416
462
|
# @param rational [Boolean] If to return the offset as a Rational.
|
417
463
|
# @param year [Fixnum] The year to which refer to. Defaults to the current year.
|
@@ -422,35 +468,49 @@ module Cowtech
|
|
422
468
|
rational ? self.class.rationalize_offset(rv) : rv
|
423
469
|
end
|
424
470
|
|
425
|
-
# Returns the standard offset for this timezone timezone when the DST (
|
471
|
+
# Returns the standard offset for this timezone timezone when the DST (DST) is active.
|
426
472
|
#
|
427
473
|
# @param rational [Boolean] If to return the offset as a Rational.
|
428
474
|
# @param year [Fixnum] The year to which refer to. Defaults to the current year.
|
429
|
-
# @return [Fixnum|Rational] The DST offset for this timezone or `0
|
475
|
+
# @return [Fixnum|Rational] The DST offset for this timezone or `0`, if the timezone doesn't use DST for that year.
|
430
476
|
def dst_offset(rational = false, year = nil)
|
431
477
|
period = self.dst_period(year)
|
432
478
|
rv = period ? period.utc_total_offset : 0
|
433
479
|
rational ? self.class.rationalize_offset(rv) : rv
|
434
480
|
end
|
435
481
|
|
436
|
-
# Returns the name for this zone with DST (
|
482
|
+
# Returns the name for this zone with DST (DST) active.
|
437
483
|
#
|
438
|
-
# @param dst_label [String] Label for the DST indication. Defaults to `(
|
484
|
+
# @param dst_label [String] Label for the DST indication. Defaults to `(DST)`.
|
439
485
|
# @param year [Fixnum] The year to which refer to. Defaults to the current year.
|
486
|
+
# @param name [String] The name to use for this zone. Defaults to the zone name.
|
440
487
|
# @return [String] The name for the zone with DST or `nil`, if the timezone doesn't use DST for that year.
|
441
|
-
def dst_name(dst_label = nil, year = nil)
|
442
|
-
dst_label ||= "(
|
488
|
+
def dst_name(dst_label = nil, year = nil, name = nil)
|
489
|
+
dst_label ||= "(DST)"
|
490
|
+
name ||= self.name
|
443
491
|
|
444
492
|
self.uses_dst?(year) ? "#{name} #{dst_label}" : nil
|
445
493
|
end
|
446
494
|
|
447
|
-
# Returns
|
495
|
+
# Returns the name for this zone with DST (DST) active.
|
496
|
+
#
|
497
|
+
# @param name [String] The name to use for this zone. Defaults to the zone name.
|
498
|
+
# @param colon [Boolean] If to put the colon in the output string.
|
499
|
+
# @return [String] The name for this zone.
|
500
|
+
def to_str(name = nil, colon = true)
|
501
|
+
name ||= self.aliases.first
|
502
|
+
"(GMT#{self.formatted_offset(colon)}) #{name}"
|
503
|
+
end
|
504
|
+
|
505
|
+
# Returns a string representation for this zone with DST (DST) active.
|
448
506
|
#
|
449
|
-
# @param dst_label [String] Label for the DST indication. Defaults to `(
|
507
|
+
# @param dst_label [String] Label for the DST indication. Defaults to `(DST)`.
|
450
508
|
# @param year [Fixnum] The year to which refer to. Defaults to the current year.
|
509
|
+
# @param name [String] The name to use for this zone. Defaults to the zone name.
|
451
510
|
# @return [String] The string representation for the zone with DST or `nil`, if the timezone doesn't use DST for that year.
|
452
|
-
def
|
453
|
-
dst_label ||= "(
|
511
|
+
def to_str_with_dst(dst_label = nil, year = nil, name = nil)
|
512
|
+
dst_label ||= "(DST)"
|
513
|
+
name ||= self.aliases.first
|
454
514
|
|
455
515
|
if self.uses_dst?(year) then
|
456
516
|
period = self.dst_period(year)
|
@@ -464,19 +524,21 @@ module Cowtech
|
|
464
524
|
# Returns a parametized string representation for this zone.
|
465
525
|
#
|
466
526
|
# @param with_offset [Boolean] If to include offset into the representation.
|
527
|
+
# @param name [String] The name to use for this zone. Defaults to the zone name.
|
467
528
|
# @return [String] The parametized string representation for this zone.
|
468
|
-
def
|
469
|
-
::ActiveSupport::TimeZone.parameterize_zone(self.
|
529
|
+
def to_str_parameterized(with_offset = true, name = nil)
|
530
|
+
::ActiveSupport::TimeZone.parameterize_zone(name || self.to_str, with_offset)
|
470
531
|
end
|
471
532
|
|
472
|
-
# Returns a parametized string representation for this zone with DST (
|
533
|
+
# Returns a parametized string representation for this zone with DST (DST) active.
|
473
534
|
#
|
474
|
-
# @param dst_label [String] Label for the DST indication. Defaults to `(
|
535
|
+
# @param dst_label [String] Label for the DST indication. Defaults to `(DST)`.
|
475
536
|
# @param with_offset [Boolean] If to include offset into the representation.
|
476
537
|
# @param year [Fixnum] The year to which refer to. Defaults to the current year.
|
538
|
+
# @param name [String] The name to use for this zone. Defaults to the zone name.
|
477
539
|
# @return [String] The parametized string representation for this zone with DST or `nil`, if the timezone doesn't use DST for that year.
|
478
|
-
def
|
479
|
-
rv = self.
|
540
|
+
def to_str_with_dst_parameterized(dst_label = nil, with_offset = true, year = nil, name = nil)
|
541
|
+
rv = self.to_str_with_dst(dst_label, year, name)
|
480
542
|
rv ? ::ActiveSupport::TimeZone.parameterize_zone(rv) : nil
|
481
543
|
end
|
482
544
|
end
|
@@ -224,19 +224,19 @@ describe Cowtech::Extensions::TimeZone do
|
|
224
224
|
|
225
225
|
describe ".parameterize_zone" do
|
226
226
|
it "should return the parameterized version of the zone" do
|
227
|
-
::ActiveSupport::TimeZone.parameterize_zone(reference_zone).should == reference_zone.
|
228
|
-
::ActiveSupport::TimeZone.parameterize_zone(reference_zone).should == reference_zone.
|
229
|
-
::ActiveSupport::TimeZone.parameterize_zone(reference_zone, false).should == reference_zone.
|
227
|
+
::ActiveSupport::TimeZone.parameterize_zone(reference_zone.to_str).should == reference_zone.to_str_parameterized
|
228
|
+
::ActiveSupport::TimeZone.parameterize_zone(reference_zone.to_str).should == reference_zone.to_str_parameterized
|
229
|
+
::ActiveSupport::TimeZone.parameterize_zone(reference_zone.to_str, false).should == reference_zone.to_str_parameterized(false)
|
230
230
|
::ActiveSupport::TimeZone.parameterize_zone("INVALID").should == "invalid"
|
231
231
|
end
|
232
232
|
end
|
233
233
|
|
234
234
|
describe ".unparameterize_zone" do
|
235
235
|
it "should return the parameterized version of the zone" do
|
236
|
-
::ActiveSupport::TimeZone.unparameterize_zone(reference_zone.
|
237
|
-
::ActiveSupport::TimeZone.unparameterize_zone(reference_zone.
|
238
|
-
::ActiveSupport::TimeZone.unparameterize_zone(reference_zone.
|
239
|
-
::ActiveSupport::TimeZone.unparameterize_zone(reference_zone.
|
236
|
+
::ActiveSupport::TimeZone.unparameterize_zone(reference_zone.to_str_parameterized).should == reference_zone
|
237
|
+
::ActiveSupport::TimeZone.unparameterize_zone(reference_zone.to_str_parameterized, true).should == reference_zone.to_str
|
238
|
+
::ActiveSupport::TimeZone.unparameterize_zone(reference_zone.to_str_with_dst_parameterized).should == reference_zone
|
239
|
+
::ActiveSupport::TimeZone.unparameterize_zone(reference_zone.to_str_with_dst_parameterized, true).should == reference_zone.to_str_with_dst
|
240
240
|
::ActiveSupport::TimeZone.unparameterize_zone("INVALID").should == nil
|
241
241
|
end
|
242
242
|
end
|
@@ -244,8 +244,8 @@ describe Cowtech::Extensions::TimeZone do
|
|
244
244
|
describe ".find" do
|
245
245
|
it "should find timezones" do
|
246
246
|
::ActiveSupport::TimeZone.find("(GMT-07:00) Mountain Time (US & Canada)").should == reference_zone
|
247
|
-
::ActiveSupport::TimeZone.find("(GMT-06:00) Mountain Time (US & Canada) (
|
248
|
-
::ActiveSupport::TimeZone.find("(GMT-06:00) Mountain Time (US & Canada)
|
247
|
+
::ActiveSupport::TimeZone.find("(GMT-06:00) Mountain Time (US & Canada) (DST)").should == reference_zone
|
248
|
+
::ActiveSupport::TimeZone.find("(GMT-06:00) Mountain Time (US & Canada) Daylight Saving Time", "Daylight Saving Time").should == reference_zone
|
249
249
|
::ActiveSupport::TimeZone.find("INVALID", "INVALID").should be_nil
|
250
250
|
end
|
251
251
|
end
|
@@ -253,8 +253,8 @@ describe Cowtech::Extensions::TimeZone do
|
|
253
253
|
describe ".list_all" do
|
254
254
|
it "should list all timezones" do
|
255
255
|
::ActiveSupport::TimeZone.list_all(false).should == ::ActiveSupport::TimeZone.all.collect(&:to_s)
|
256
|
-
::ActiveSupport::TimeZone.list_all(true).should include("(GMT-06:00)
|
257
|
-
::ActiveSupport::TimeZone.list_all(true, "
|
256
|
+
::ActiveSupport::TimeZone.list_all(true).should include("(GMT-06:00) #{reference_zone.aliases.first} (DST)")
|
257
|
+
::ActiveSupport::TimeZone.list_all(true, "Daylight Saving Time").should include("(GMT-06:00) #{reference_zone.aliases.first} Daylight Saving Time")
|
258
258
|
end
|
259
259
|
end
|
260
260
|
|
@@ -288,11 +288,11 @@ describe Cowtech::Extensions::TimeZone do
|
|
288
288
|
end
|
289
289
|
|
290
290
|
describe "#dst_name" do
|
291
|
-
it "should correctly get zone name with
|
292
|
-
reference_zone.dst_name.should == "Mountain Time (US & Canada) (
|
293
|
-
reference_zone.dst_name("
|
291
|
+
it "should correctly get zone name with Daylight Saving Time" do
|
292
|
+
reference_zone.dst_name.should == "Mountain Time (US & Canada) (DST)"
|
293
|
+
reference_zone.dst_name("Daylight Saving Time").should == "Mountain Time (US & Canada) Daylight Saving Time"
|
294
294
|
reference_zone.dst_name(nil, 1000).should be_nil
|
295
|
-
zone_without_dst.
|
295
|
+
zone_without_dst.to_str_with_dst.should be_nil
|
296
296
|
end
|
297
297
|
end
|
298
298
|
|
@@ -314,28 +314,31 @@ describe Cowtech::Extensions::TimeZone do
|
|
314
314
|
end
|
315
315
|
end
|
316
316
|
|
317
|
-
describe "#
|
318
|
-
it "should correctly format zone with
|
319
|
-
reference_zone.
|
320
|
-
reference_zone.
|
321
|
-
reference_zone.
|
322
|
-
|
317
|
+
describe "#to_str_with_dst" do
|
318
|
+
it "should correctly format zone with Daylight Saving Time" do
|
319
|
+
reference_zone.to_str_with_dst.should == "(GMT-06:00) #{reference_zone.aliases.first} (DST)"
|
320
|
+
reference_zone.to_str_with_dst("Daylight Saving Time").should == "(GMT-06:00) #{reference_zone.aliases.first} Daylight Saving Time"
|
321
|
+
reference_zone.to_str_with_dst("Daylight Saving Time", nil, "NAME").should == "(GMT-06:00) NAME Daylight Saving Time"
|
322
|
+
reference_zone.to_str_with_dst(nil, 1000).should be_nil
|
323
|
+
zone_without_dst.to_str_with_dst.should be_nil
|
323
324
|
end
|
324
325
|
end
|
325
326
|
|
326
|
-
describe "#
|
327
|
+
describe "#to_str_parameterized" do
|
327
328
|
it "should correctly format (parameterized) zone" do
|
328
|
-
reference_zone.
|
329
|
-
reference_zone.
|
329
|
+
reference_zone.to_str_parameterized.should == ::ActiveSupport::TimeZone.parameterize_zone(reference_zone.to_str)
|
330
|
+
reference_zone.to_str_parameterized(false).should == ::ActiveSupport::TimeZone.parameterize_zone(reference_zone.to_str, false)
|
331
|
+
reference_zone.to_str_parameterized(false, "NAME SPACE").should == ::ActiveSupport::TimeZone.parameterize_zone("NAME SPACE", false)
|
330
332
|
end
|
331
333
|
end
|
332
334
|
|
333
|
-
describe "#
|
334
|
-
it "should correctly format (parameterized) zone with
|
335
|
-
reference_zone.
|
336
|
-
reference_zone.
|
337
|
-
reference_zone.
|
338
|
-
|
335
|
+
describe "#to_str_with_dst_parameterized" do
|
336
|
+
it "should correctly format (parameterized) zone with Daylight Saving Time" do
|
337
|
+
reference_zone.to_str_with_dst_parameterized.should == "-0600@america-denver-dst"
|
338
|
+
reference_zone.to_str_with_dst_parameterized("Daylight Saving Time").should == "-0600@america-denver-daylight-saving-time"
|
339
|
+
reference_zone.to_str_with_dst_parameterized(nil, false, 1000).should be_nil
|
340
|
+
reference_zone.to_str_with_dst_parameterized("Daylight Saving Time", true, nil, "NAME SPACE").should == "-0600@name-space-daylight-saving-time"
|
341
|
+
zone_without_dst.to_str_with_dst_parameterized.should be_nil
|
339
342
|
end
|
340
343
|
end
|
341
344
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cowtech-extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|