Hello community,
here is the log from the commit of package rubygem-activesupport-5_0 for
openSUSE:Factory checked in at 2017-06-08 14:59:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-activesupport-5_0 (Old)
and /work/SRC/openSUSE:Factory/.rubygem-activesupport-5_0.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-activesupport-5_0"
Thu Jun 8 14:59:50 2017 rev:5 rq:497671 version:5.0.3
Changes:
--------
---
/work/SRC/openSUSE:Factory/rubygem-activesupport-5_0/rubygem-activesupport-5_0.changes
2017-03-21 22:49:29.479272902 +0100
+++
/work/SRC/openSUSE:Factory/.rubygem-activesupport-5_0.new/rubygem-activesupport-5_0.changes
2017-06-08 14:59:55.425098945 +0200
@@ -1,0 +2,40 @@
+Tue May 23 09:38:25 UTC 2017 - [email protected]
+
+- updated to version 5.0.3
+ see installed CHANGELOG.md
+
+ * `ActiveSupport::EventedFileUpdateChecker` no longer listens to
+ directories outside of the application directory.
+
+ *radiospiel*
+
+ * Return unmapped timezones from `country_zones`
+
+ If a country doesn't exist in the MAPPINGS hash then create a new
+ `ActiveSupport::Timezone` instance using the supplied timezone id.
+
+ Fixes #28431.
+
+ *Andrew White*
+
+ * Fixed bug in `DateAndTime::Compatibility#to_time` that caused it to
+ raise `RuntimeError: can't modify frozen Time` when called on any frozen
`Time`.
+ Properly pass through the frozen `Time` or `ActiveSupport::TimeWithZone`
object
+ when calling `#to_time`.
+
+ *Kevin McPhillips* & *Andrew White*
+
+ * Fix inconsistent results when parsing large durations and constructing
durations from code
+
+ ActiveSupport::Duration.parse('P3Y') == 3.years # It should be true
+
+ Duration parsing made independent from any moment of time:
+ Fixed length in seconds is assigned to each duration part during parsing.
+
+ Methods on `Numeric` like `2.days` now use these predefined durations
+ to avoid duplicating of duration constants through the codebase and
+ eliminate creation of intermediate durations.
+
+ *Andrey Novikov, Andrew White*
+
+-------------------------------------------------------------------
Old:
----
activesupport-5.0.2.gem
New:
----
activesupport-5.0.3.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-activesupport-5_0.spec ++++++
--- /var/tmp/diff_new_pack.B80E9W/_old 2017-06-08 14:59:55.901031775 +0200
+++ /var/tmp/diff_new_pack.B80E9W/_new 2017-06-08 14:59:55.905031211 +0200
@@ -24,7 +24,7 @@
#
Name: rubygem-activesupport-5_0
-Version: 5.0.2
+Version: 5.0.3
Release: 0
%define mod_name activesupport
%define mod_full_name %{mod_name}-%{version}
++++++ activesupport-5.0.2.gem -> activesupport-5.0.3.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md 2017-03-02 00:11:56.000000000 +0100
+++ new/CHANGELOG.md 2017-05-12 22:03:19.000000000 +0200
@@ -1,7 +1,42 @@
+* `ActiveSupport::EventedFileUpdateChecker` no longer listens to
+ directories outside of the application directory.
+
+ *radiospiel*
+
+* Return unmapped timezones from `country_zones`
+
+ If a country doesn't exist in the MAPPINGS hash then create a new
+ `ActiveSupport::Timezone` instance using the supplied timezone id.
+
+ Fixes #28431.
+
+ *Andrew White*
+
+* Fixed bug in `DateAndTime::Compatibility#to_time` that caused it to
+ raise `RuntimeError: can't modify frozen Time` when called on any frozen
`Time`.
+ Properly pass through the frozen `Time` or `ActiveSupport::TimeWithZone`
object
+ when calling `#to_time`.
+
+ *Kevin McPhillips* & *Andrew White*
+
+* Fix inconsistent results when parsing large durations and constructing
durations from code
+
+ ActiveSupport::Duration.parse('P3Y') == 3.years # It should be true
+
+ Duration parsing made independent from any moment of time:
+ Fixed length in seconds is assigned to each duration part during parsing.
+
+ Methods on `Numeric` like `2.days` now use these predefined durations
+ to avoid duplicating of duration constants through the codebase and
+ eliminate creation of intermediate durations.
+
+ *Andrey Novikov, Andrew White*
+
+
## Rails 5.0.2 (March 01, 2017) ##
* In Core Extensions, make `MarshalWithAutoloading#load` pass through the
second, optional
- argument for `Marshal#load( source [, proc] )`. This way we don't have to
do
+ argument for `Marshal#load( source [, proc] )`. This way we don't have to
do
`Marshal.method(:load).super_method.call(sourse, proc)` just to be able to
pass a proc.
*Jeff Latz*
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_support/cache/strategy/local_cache_middleware.rb
new/lib/active_support/cache/strategy/local_cache_middleware.rb
--- old/lib/active_support/cache/strategy/local_cache_middleware.rb
2017-03-02 00:11:56.000000000 +0100
+++ new/lib/active_support/cache/strategy/local_cache_middleware.rb
2017-05-12 22:03:19.000000000 +0200
@@ -29,13 +29,13 @@
response[2] = ::Rack::BodyProxy.new(response[2]) do
LocalCacheRegistry.set_cache_for(local_cache_key, nil)
end
+ cleanup_on_body_close = true
response
rescue Rack::Utils::InvalidParameterError
- LocalCacheRegistry.set_cache_for(local_cache_key, nil)
[400, {}, []]
- rescue Exception
- LocalCacheRegistry.set_cache_for(local_cache_key, nil)
- raise
+ ensure
+ LocalCacheRegistry.set_cache_for(local_cache_key, nil) unless
+ cleanup_on_body_close
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_support/core_ext/date_and_time/compatibility.rb
new/lib/active_support/core_ext/date_and_time/compatibility.rb
--- old/lib/active_support/core_ext/date_and_time/compatibility.rb
2017-03-02 00:11:56.000000000 +0100
+++ new/lib/active_support/core_ext/date_and_time/compatibility.rb
2017-05-12 22:03:19.000000000 +0200
@@ -10,13 +10,5 @@
# this behavior, but new apps will have an initializer that sets
# this to true, because the new behavior is preferred.
mattr_accessor(:preserve_timezone, instance_writer: false) { false }
-
- def to_time
- if preserve_timezone
- @_to_time_with_instance_offset ||= getlocal(utc_offset)
- else
- @_to_time_with_system_offset ||= getlocal
- end
- end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_support/core_ext/date_time/compatibility.rb
new/lib/active_support/core_ext/date_time/compatibility.rb
--- old/lib/active_support/core_ext/date_time/compatibility.rb 2017-03-02
00:11:56.000000000 +0100
+++ new/lib/active_support/core_ext/date_time/compatibility.rb 2017-05-12
22:03:19.000000000 +0200
@@ -1,5 +1,15 @@
require 'active_support/core_ext/date_and_time/compatibility'
class DateTime
- prepend DateAndTime::Compatibility
+ include DateAndTime::Compatibility
+
+ remove_possible_method :to_time
+
+ # Either return an instance of `Time` with the same UTC offset
+ # as +self+ or an instance of `Time` representing the same time
+ # in the the local system timezone depending on the setting of
+ # on the setting of +ActiveSupport.to_time_preserves_timezone+.
+ def to_time
+ preserve_timezone ? getlocal(utc_offset) : getlocal
+ end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/core_ext/enumerable.rb
new/lib/active_support/core_ext/enumerable.rb
--- old/lib/active_support/core_ext/enumerable.rb 2017-03-02
00:11:56.000000000 +0100
+++ new/lib/active_support/core_ext/enumerable.rb 2017-05-12
22:03:19.000000000 +0200
@@ -1,28 +1,50 @@
module Enumerable
- # Calculates a sum from the elements.
+ # Enumerable#sum was added in Ruby 2.4 but it only works with Numeric
elements
+ # when we omit an identity.
#
- # payments.sum { |p| p.price * p.tax_rate }
- # payments.sum(&:price)
- #
- # The latter is a shortcut for:
- #
- # payments.inject(0) { |sum, p| sum + p.price }
- #
- # It can also calculate the sum without the use of a block.
- #
- # [5, 15, 10].sum # => 30
- # ['foo', 'bar'].sum # => "foobar"
- # [[1, 2], [3, 1, 5]].sum => [1, 2, 3, 1, 5]
- #
- # The default sum of an empty list is zero. You can override this default:
- #
- # [].sum(Payment.new(0)) { |i| i.amount } # => Payment.new(0)
- def sum(identity = nil, &block)
- if block_given?
- map(&block).sum(identity)
- else
- sum = identity ? inject(identity, :+) : inject(:+)
- sum || identity || 0
+ # We tried shimming it to attempt the fast native method, rescue TypeError,
+ # and fall back to the compatible implementation, but that's much slower than
+ # just calling the compat method in the first place.
+ if Enumerable.instance_methods(false).include?(:sum) && !((?a..?b).sum
rescue false)
+ # We can't use Refinements here because Refinements with Module which will
be prepended
+ # doesn't work well https://bugs.ruby-lang.org/issues/13446
+ alias :_original_sum_with_required_identity :sum
+ private :_original_sum_with_required_identity
+ # Calculates a sum from the elements.
+ #
+ # payments.sum { |p| p.price * p.tax_rate }
+ # payments.sum(&:price)
+ #
+ # The latter is a shortcut for:
+ #
+ # payments.inject(0) { |sum, p| sum + p.price }
+ #
+ # It can also calculate the sum without the use of a block.
+ #
+ # [5, 15, 10].sum # => 30
+ # ['foo', 'bar'].sum # => "foobar"
+ # [[1, 2], [3, 1, 5]].sum # => [1, 2, 3, 1, 5]
+ #
+ # The default sum of an empty list is zero. You can override this default:
+ #
+ # [].sum(Payment.new(0)) { |i| i.amount } # => Payment.new(0)
+ def sum(identity = nil, &block)
+ if identity
+ _original_sum_with_required_identity(identity, &block)
+ elsif block_given?
+ map(&block).sum(identity)
+ else
+ inject(:+) || 0
+ end
+ end
+ else
+ def sum(identity = nil, &block)
+ if block_given?
+ map(&block).sum(identity)
+ else
+ sum = identity ? inject(identity, :+) : inject(:+)
+ sum || identity || 0
+ end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/core_ext/integer/time.rb
new/lib/active_support/core_ext/integer/time.rb
--- old/lib/active_support/core_ext/integer/time.rb 2017-03-02
00:11:56.000000000 +0100
+++ new/lib/active_support/core_ext/integer/time.rb 2017-05-12
22:03:19.000000000 +0200
@@ -18,12 +18,12 @@
# # equivalent to Time.now.advance(months: 4, years: 5)
# (4.months + 5.years).from_now
def months
- ActiveSupport::Duration.new(self * 30.days, [[:months, self]])
+ ActiveSupport::Duration.months(self)
end
alias :month :months
def years
- ActiveSupport::Duration.new(self * 365.25.days.to_i, [[:years, self]])
+ ActiveSupport::Duration.years(self)
end
alias :year :years
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/core_ext/numeric/time.rb
new/lib/active_support/core_ext/numeric/time.rb
--- old/lib/active_support/core_ext/numeric/time.rb 2017-03-02
00:11:56.000000000 +0100
+++ new/lib/active_support/core_ext/numeric/time.rb 2017-05-12
22:03:19.000000000 +0200
@@ -19,7 +19,7 @@
# # equivalent to Time.current.advance(months: 4, years: 5)
# (4.months + 5.years).from_now
def seconds
- ActiveSupport::Duration.new(self, [[:seconds, self]])
+ ActiveSupport::Duration.seconds(self)
end
alias :second :seconds
@@ -27,7 +27,7 @@
#
# 2.minutes # => 2 minutes
def minutes
- ActiveSupport::Duration.new(self * 60, [[:minutes, self]])
+ ActiveSupport::Duration.minutes(self)
end
alias :minute :minutes
@@ -35,7 +35,7 @@
#
# 2.hours # => 2 hours
def hours
- ActiveSupport::Duration.new(self * 3600, [[:hours, self]])
+ ActiveSupport::Duration.hours(self)
end
alias :hour :hours
@@ -43,7 +43,7 @@
#
# 2.days # => 2 days
def days
- ActiveSupport::Duration.new(self * 24.hours, [[:days, self]])
+ ActiveSupport::Duration.days(self)
end
alias :day :days
@@ -51,7 +51,7 @@
#
# 2.weeks # => 2 weeks
def weeks
- ActiveSupport::Duration.new(self * 7.days, [[:weeks, self]])
+ ActiveSupport::Duration.weeks(self)
end
alias :week :weeks
@@ -59,7 +59,7 @@
#
# 2.fortnights # => 4 weeks
def fortnights
- ActiveSupport::Duration.new(self * 2.weeks, [[:weeks, self * 2]])
+ ActiveSupport::Duration.weeks(self * 2)
end
alias :fortnight :fortnights
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/core_ext/time/compatibility.rb
new/lib/active_support/core_ext/time/compatibility.rb
--- old/lib/active_support/core_ext/time/compatibility.rb 2017-03-02
00:11:56.000000000 +0100
+++ new/lib/active_support/core_ext/time/compatibility.rb 2017-05-12
22:03:19.000000000 +0200
@@ -1,5 +1,14 @@
-require 'active_support/core_ext/date_and_time/compatibility'
+require "active_support/core_ext/date_and_time/compatibility"
+require "active_support/core_ext/module/remove_method"
class Time
- prepend DateAndTime::Compatibility
+ include DateAndTime::Compatibility
+
+ remove_possible_method :to_time
+
+ # Either return +self+ or the time in the local system timezone depending
+ # on the setting of +ActiveSupport.to_time_preserves_timezone+.
+ def to_time
+ preserve_timezone ? self : getlocal
+ end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/duration.rb
new/lib/active_support/duration.rb
--- old/lib/active_support/duration.rb 2017-03-02 00:11:56.000000000 +0100
+++ new/lib/active_support/duration.rb 2017-05-12 22:03:19.000000000 +0200
@@ -7,13 +7,82 @@
#
# 1.month.ago # equivalent to Time.now.advance(months: -1)
class Duration
- EPOCH = ::Time.utc(2000)
+ SECONDS_PER_MINUTE = 60
+ SECONDS_PER_HOUR = 3600
+ SECONDS_PER_DAY = 86400
+ SECONDS_PER_WEEK = 604800
+ SECONDS_PER_MONTH = 2592000 # 30 days
+ SECONDS_PER_YEAR = 31557600 # length of a julian year (365.2425 days)
+
+ PARTS_IN_SECONDS = {
+ seconds: 1,
+ minutes: SECONDS_PER_MINUTE,
+ hours: SECONDS_PER_HOUR,
+ days: SECONDS_PER_DAY,
+ weeks: SECONDS_PER_WEEK,
+ months: SECONDS_PER_MONTH,
+ years: SECONDS_PER_YEAR
+ }.freeze
attr_accessor :value, :parts
autoload :ISO8601Parser, 'active_support/duration/iso8601_parser'
autoload :ISO8601Serializer, 'active_support/duration/iso8601_serializer'
+ class << self
+ # Creates a new Duration from string formatted according to ISO 8601
Duration.
+ #
+ # See {ISO 8601}[http://en.wikipedia.org/wiki/ISO_8601#Durations] for
more information.
+ # This method allows negative parts to be present in pattern.
+ # If invalid string is provided, it will raise
+ActiveSupport::Duration::ISO8601Parser::ParsingError+.
+ def parse(iso8601duration)
+ parts = ISO8601Parser.new(iso8601duration).parse!
+ new(calculate_total_seconds(parts), parts)
+ end
+
+ def ===(other) #:nodoc:
+ other.is_a?(Duration)
+ rescue ::NoMethodError
+ false
+ end
+
+ def seconds(value) #:nodoc:
+ new(value, [[:seconds, value]])
+ end
+
+ def minutes(value) #:nodoc:
+ new(value * SECONDS_PER_MINUTE, [[:minutes, value]])
+ end
+
+ def hours(value) #:nodoc:
+ new(value * SECONDS_PER_HOUR, [[:hours, value]])
+ end
+
+ def days(value) #:nodoc:
+ new(value * SECONDS_PER_DAY, [[:days, value]])
+ end
+
+ def weeks(value) #:nodoc:
+ new(value * SECONDS_PER_WEEK, [[:weeks, value]])
+ end
+
+ def months(value) #:nodoc:
+ new(value * SECONDS_PER_MONTH, [[:months, value]])
+ end
+
+ def years(value) #:nodoc:
+ new(value * SECONDS_PER_YEAR, [[:years, value]])
+ end
+
+ private
+
+ def calculate_total_seconds(parts)
+ parts.inject(0) do |total, (part, value)|
+ total + value * PARTS_IN_SECONDS[part]
+ end
+ end
+ end
+
def initialize(value, parts) #:nodoc:
@value, @parts = value, parts
end
@@ -99,12 +168,6 @@
@value.hash
end
- def self.===(other) #:nodoc:
- other.is_a?(Duration)
- rescue ::NoMethodError
- false
- end
-
# Calculates a new Time or Date that is as far in the future
# as this Duration represents.
def since(time = ::Time.current)
@@ -135,16 +198,6 @@
@value.respond_to?(method, include_private)
end
- # Creates a new Duration from string formatted according to ISO 8601
Duration.
- #
- # See {ISO 8601}[http://en.wikipedia.org/wiki/ISO_8601#Durations] for more
information.
- # This method allows negative parts to be present in pattern.
- # If invalid string is provided, it will raise
+ActiveSupport::Duration::ISO8601Parser::ParsingError+.
- def self.parse(iso8601duration)
- parts = ISO8601Parser.new(iso8601duration).parse!
- new(EPOCH.advance(parts) - EPOCH, parts)
- end
-
# Build ISO 8601 Duration string for this duration.
# The +precision+ parameter can be used to limit seconds' precision of
duration.
def iso8601(precision: nil)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/evented_file_update_checker.rb
new/lib/active_support/evented_file_update_checker.rb
--- old/lib/active_support/evented_file_update_checker.rb 2017-03-02
00:11:56.000000000 +0100
+++ new/lib/active_support/evented_file_update_checker.rb 2017-05-12
22:03:19.000000000 +0200
@@ -121,6 +121,11 @@
dtw.compact!
dtw.uniq!
+ normalized_gem_paths = Gem.path.map { |path| File.join path, "" }
+ dtw = dtw.reject do |path|
+ normalized_gem_paths.any? { |gem_path|
path.to_s.start_with?(gem_path) }
+ end
+
@ph.filter_out_descendants(dtw)
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/gem_version.rb
new/lib/active_support/gem_version.rb
--- old/lib/active_support/gem_version.rb 2017-03-02 00:11:56.000000000
+0100
+++ new/lib/active_support/gem_version.rb 2017-05-12 22:03:19.000000000
+0200
@@ -7,7 +7,7 @@
module VERSION
MAJOR = 5
MINOR = 0
- TINY = 2
+ TINY = 3
PRE = nil
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/rescuable.rb
new/lib/active_support/rescuable.rb
--- old/lib/active_support/rescuable.rb 2017-03-02 00:11:56.000000000 +0100
+++ new/lib/active_support/rescuable.rb 2017-05-12 22:03:19.000000000 +0200
@@ -83,13 +83,19 @@
# rescue_with_handler(exception) || raise
# end
#
- # Returns the exception if it was handled and nil if it was not.
- def rescue_with_handler(exception, object: self)
+ # Returns the exception if it was handled and +nil+ if it was not.
+ def rescue_with_handler(exception, object: self, visited_exceptions: [])
+ visited_exceptions << exception
+
if handler = handler_for_rescue(exception, object: object)
handler.call exception
exception
elsif exception
- rescue_with_handler(exception.cause, object: object)
+ if visited_exceptions.include?(exception.cause)
+ nil
+ else
+ rescue_with_handler(exception.cause, object: object,
visited_exceptions: visited_exceptions)
+ end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/testing/time_helpers.rb
new/lib/active_support/testing/time_helpers.rb
--- old/lib/active_support/testing/time_helpers.rb 2017-03-02
00:11:56.000000000 +0100
+++ new/lib/active_support/testing/time_helpers.rb 2017-05-12
22:03:19.000000000 +0200
@@ -1,3 +1,5 @@
+require "active_support/core_ext/time/calculations"
+
module ActiveSupport
module Testing
class SimpleStubs # :nodoc:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/time_with_zone.rb
new/lib/active_support/time_with_zone.rb
--- old/lib/active_support/time_with_zone.rb 2017-03-02 00:11:56.000000000
+0100
+++ new/lib/active_support/time_with_zone.rb 2017-05-12 22:03:19.000000000
+0200
@@ -411,6 +411,17 @@
utc.to_datetime.new_offset(Rational(utc_offset, 86_400))
end
+ # Returns an instance of +Time+, either with the same UTC offset
+ # as +self+ or in the local system timezone depending on the setting
+ # of +ActiveSupport.to_time_preserves_timezone+.
+ def to_time
+ if preserve_timezone
+ @to_time_with_instance_offset ||= getlocal(utc_offset)
+ else
+ @to_time_with_system_offset ||= getlocal
+ end
+ end
+
# So that +self+ <tt>acts_like?(:time)</tt>.
def acts_like_time?
true
@@ -429,7 +440,7 @@
def freeze
# preload instance variables before freezing
- period; utc; time; to_datetime
+ period; utc; time; to_datetime; to_time
super
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/values/time_zone.rb
new/lib/active_support/values/time_zone.rb
--- old/lib/active_support/values/time_zone.rb 2017-03-02 00:11:56.000000000
+0100
+++ new/lib/active_support/values/time_zone.rb 2017-05-12 22:03:19.000000000
+0200
@@ -250,14 +250,21 @@
# for time zones in the country specified by its ISO 3166-1 Alpha2 code.
def country_zones(country_code)
code = country_code.to_s.upcase
- @country_zones[code] ||=
- TZInfo::Country.get(code).zone_identifiers.map do |tz_id|
- name = MAPPING.key(tz_id)
- name && self[name]
- end.compact.sort!
+ @country_zones[code] ||= load_country_zones(code)
end
private
+ def load_country_zones(code)
+ country = TZInfo::Country.get(code)
+ country.zone_identifiers.map do |tz_id|
+ if MAPPING.value?(tz_id)
+ self[MAPPING.key(tz_id)]
+ else
+ create(tz_id, nil, TZInfo::Timezone.new(tz_id))
+ end
+ end.sort!
+ end
+
def zones_map
@zones_map ||= begin
MAPPING.each_key {|place| self[place]} # load all the zones
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/xml_mini/libxml.rb
new/lib/active_support/xml_mini/libxml.rb
--- old/lib/active_support/xml_mini/libxml.rb 2017-03-02 00:11:56.000000000
+0100
+++ new/lib/active_support/xml_mini/libxml.rb 2017-05-12 22:03:19.000000000
+0200
@@ -14,11 +14,9 @@
data = StringIO.new(data || '')
end
- char = data.getc
- if char.nil?
+ if data.eof?
{}
else
- data.ungetc(char)
LibXML::XML::Parser.io(data).parse.to_hash
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/xml_mini/libxmlsax.rb
new/lib/active_support/xml_mini/libxmlsax.rb
--- old/lib/active_support/xml_mini/libxmlsax.rb 2017-03-02
00:11:56.000000000 +0100
+++ new/lib/active_support/xml_mini/libxmlsax.rb 2017-05-12
22:03:19.000000000 +0200
@@ -66,12 +66,9 @@
data = StringIO.new(data || '')
end
- char = data.getc
- if char.nil?
+ if data.eof?
{}
else
- data.ungetc(char)
-
LibXML::XML::Error.set_handler(&LibXML::XML::Error::QUIET_HANDLER)
parser = LibXML::XML::SaxParser.io(data)
document = self.document_class.new
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/xml_mini/nokogiri.rb
new/lib/active_support/xml_mini/nokogiri.rb
--- old/lib/active_support/xml_mini/nokogiri.rb 2017-03-02 00:11:56.000000000
+0100
+++ new/lib/active_support/xml_mini/nokogiri.rb 2017-05-12 22:03:19.000000000
+0200
@@ -19,11 +19,9 @@
data = StringIO.new(data || '')
end
- char = data.getc
- if char.nil?
+ if data.eof?
{}
else
- data.ungetc(char)
doc = Nokogiri::XML(data)
raise doc.errors.first if doc.errors.length > 0
doc.to_hash
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/xml_mini/nokogirisax.rb
new/lib/active_support/xml_mini/nokogirisax.rb
--- old/lib/active_support/xml_mini/nokogirisax.rb 2017-03-02
00:11:56.000000000 +0100
+++ new/lib/active_support/xml_mini/nokogirisax.rb 2017-05-12
22:03:19.000000000 +0200
@@ -72,11 +72,9 @@
data = StringIO.new(data || '')
end
- char = data.getc
- if char.nil?
+ if data.eof?
{}
else
- data.ungetc(char)
document = self.document_class.new
parser = Nokogiri::XML::SAX::Parser.new(document)
parser.parse(data)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2017-03-02 00:11:56.000000000 +0100
+++ new/metadata 2017-05-12 22:03:19.000000000 +0200
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: activesupport
version: !ruby/object:Gem::Version
- version: 5.0.2
+ version: 5.0.3
platform: ruby
authors:
- David Heinemeier Hansson
autorequire:
bindir: bin
cert_chain: []
-date: 2017-03-01 00:00:00.000000000 Z
+date: 2017-05-12 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: i18n
@@ -342,3 +342,4 @@
summary: A toolkit of support libraries and Ruby core extensions extracted
from the
Rails framework.
test_files: []
+has_rdoc: