Hello community,
here is the log from the commit of package rubygem-activesupport-4_2 for
openSUSE:Factory checked in at 2017-03-21 22:50:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-activesupport-4_2 (Old)
and /work/SRC/openSUSE:Factory/.rubygem-activesupport-4_2.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-activesupport-4_2"
Tue Mar 21 22:50:22 2017 rev:12 rq:479674 version:4.2.8
Changes:
--------
---
/work/SRC/openSUSE:Factory/rubygem-activesupport-4_2/rubygem-activesupport-4_2.changes
2016-08-25 09:54:06.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.rubygem-activesupport-4_2.new/rubygem-activesupport-4_2.changes
2017-03-21 22:50:23.375653443 +0100
@@ -1,0 +2,99 @@
+Wed Feb 22 05:30:40 UTC 2017 - [email protected]
+
+- updated to version 4.2.8
+ see installed CHANGELOG.md
+
+ ## Rails 4.2.8 (February 21, 2017) ##
+
+ * Make `getlocal` and `getutc` always return instances of `Time` for
+ `ActiveSupport::TimeWithZone` and `DateTime`. This eliminates a possible
+ stack level too deep error in `to_time` where
`ActiveSupport::TimeWithZone`
+ was wrapping a `DateTime` instance. As a consequence of this the internal
+ time value in `ActiveSupport::TimeWithZone` is now always an instance of
+ `Time` in the UTC timezone, whether that's as the UTC time directly or
+ a representation of the local time in the timezone. There should be no
+ consequences of this internal change and if there are it's a bug due to
+ leaky abstractions.
+
+ *Andrew White*
+
+ * Add `DateTime#subsec` to return the fraction of a second as a `Rational`.
+
+ *Andrew White*
+
+ * Add additional aliases for `DateTime#utc` to mirror the ones on
+ `ActiveSupport::TimeWithZone` and `Time`.
+
+ *Andrew White*
+
+ * Add `DateTime#localtime` to return an instance of `Time` in the system's
+ local timezone. Also aliased to `getlocal`.
+
+ *Andrew White*, *Yuichiro Kaneko*
+
+ * Add `Time#sec_fraction` to return the fraction of a second as a
`Rational`.
+
+ *Andrew White*
+
+ * Add `ActiveSupport.to_time_preserves_timezone` config option to control
+ how `to_time` handles timezones. In Ruby 2.4+ the behavior will change
+ from converting to the local system timezone, to preserving the timezone
+ of the receiver. This config option defaults to false so that apps made
+ with earlier versions of Rails are not affected when upgrading, e.g:
+
+ >> ENV['TZ'] = 'US/Eastern'
+
+ >> "2016-04-23T10:23:12.000Z".to_time
+ => "2016-04-23T06:23:12.000-04:00"
+
+ >> ActiveSupport.to_time_preserves_timezone = true
+
+ >> "2016-04-23T10:23:12.000Z".to_time
+ => "2016-04-23T10:23:12.000Z"
+
+ Fixes #24617.
+
+ *Andrew White*
+
+ * Add `init_with` to `ActiveSupport::TimeWithZone` and
`ActiveSupport::TimeZone`
+
+ It is helpful to be able to run apps concurrently written in successive
+ versions of Rails to aid migration, e.g. run Rails 4.2 and 5.0 variants
+ of your application at the same time to carry out A/B testing.
+
+ To do this serialization formats need to be cross compatible and the
+ change in 3aa26cf didn't meet this criteria because the Psych loader
+ checks for the existence of `init_with` before setting the instance
+ variables and the wrapping behavior of `ActiveSupport::TimeWithZone`
+ tries to see if the `Time` instance responds to `init_with` before the
+ `@time` variable is set.
+
+ To fix this we backported just the `init_with` behavior from the change
+ in 3aa26cf. If the revived instance is then written out to YAML again
+ it will revert to the default Rails 4.2 behavior of converting it to
+ a UTC timestamp string.
+
+ Fixes #26296.
+
+ *Andrew White*
+
+ * Fix `ActiveSupport::TimeWithZone#in` across DST boundaries.
+
+ Previously calls to `in` were being sent to the non-DST aware
+ method `Time#since` via `method_missing`. It is now aliased to
+ the DST aware `ActiveSupport::TimeWithZone#since` which handles
+ transitions across DST boundaries, e.g:
+
+ Time.zone = "US/Eastern"
+
+ t = Time.zone.local(2016,11,6,1)
+ # => Sun, 06 Nov 2016 01:00:00 EDT -05:00
+
+ t.in(1.hour)
+ # => Sun, 06 Nov 2016 01:00:00 EST -05:00
+
+ Fixes #26580.
+
+ *Thomas Balthazar*
+
+-------------------------------------------------------------------
Old:
----
activesupport-4.2.7.1.gem
New:
----
activesupport-4.2.8.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-activesupport-4_2.spec ++++++
--- /var/tmp/diff_new_pack.wZvKYd/_old 2017-03-21 22:50:24.031560716 +0100
+++ /var/tmp/diff_new_pack.wZvKYd/_new 2017-03-21 22:50:24.031560716 +0100
@@ -1,7 +1,7 @@
#
# spec file for package rubygem-activesupport-4_2
#
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
#
Name: rubygem-activesupport-4_2
-Version: 4.2.7.1
+Version: 4.2.8
Release: 0
%define mod_name activesupport
%define mod_full_name %{mod_name}-%{version}
++++++ activesupport-4.2.7.1.gem -> activesupport-4.2.8.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md 2016-08-11 00:25:24.000000000 +0200
+++ new/CHANGELOG.md 2017-02-21 17:06:59.000000000 +0100
@@ -1,3 +1,97 @@
+## Rails 4.2.8 (February 21, 2017) ##
+
+* Make `getlocal` and `getutc` always return instances of `Time` for
+ `ActiveSupport::TimeWithZone` and `DateTime`. This eliminates a possible
+ stack level too deep error in `to_time` where `ActiveSupport::TimeWithZone`
+ was wrapping a `DateTime` instance. As a consequence of this the internal
+ time value in `ActiveSupport::TimeWithZone` is now always an instance of
+ `Time` in the UTC timezone, whether that's as the UTC time directly or
+ a representation of the local time in the timezone. There should be no
+ consequences of this internal change and if there are it's a bug due to
+ leaky abstractions.
+
+ *Andrew White*
+
+* Add `DateTime#subsec` to return the fraction of a second as a `Rational`.
+
+ *Andrew White*
+
+* Add additional aliases for `DateTime#utc` to mirror the ones on
+ `ActiveSupport::TimeWithZone` and `Time`.
+
+ *Andrew White*
+
+* Add `DateTime#localtime` to return an instance of `Time` in the system's
+ local timezone. Also aliased to `getlocal`.
+
+ *Andrew White*, *Yuichiro Kaneko*
+
+* Add `Time#sec_fraction` to return the fraction of a second as a `Rational`.
+
+ *Andrew White*
+
+* Add `ActiveSupport.to_time_preserves_timezone` config option to control
+ how `to_time` handles timezones. In Ruby 2.4+ the behavior will change
+ from converting to the local system timezone, to preserving the timezone
+ of the receiver. This config option defaults to false so that apps made
+ with earlier versions of Rails are not affected when upgrading, e.g:
+
+ >> ENV['TZ'] = 'US/Eastern'
+
+ >> "2016-04-23T10:23:12.000Z".to_time
+ => "2016-04-23T06:23:12.000-04:00"
+
+ >> ActiveSupport.to_time_preserves_timezone = true
+
+ >> "2016-04-23T10:23:12.000Z".to_time
+ => "2016-04-23T10:23:12.000Z"
+
+ Fixes #24617.
+
+ *Andrew White*
+
+* Add `init_with` to `ActiveSupport::TimeWithZone` and
`ActiveSupport::TimeZone`
+
+ It is helpful to be able to run apps concurrently written in successive
+ versions of Rails to aid migration, e.g. run Rails 4.2 and 5.0 variants
+ of your application at the same time to carry out A/B testing.
+
+ To do this serialization formats need to be cross compatible and the
+ change in 3aa26cf didn't meet this criteria because the Psych loader
+ checks for the existence of `init_with` before setting the instance
+ variables and the wrapping behavior of `ActiveSupport::TimeWithZone`
+ tries to see if the `Time` instance responds to `init_with` before the
+ `@time` variable is set.
+
+ To fix this we backported just the `init_with` behavior from the change
+ in 3aa26cf. If the revived instance is then written out to YAML again
+ it will revert to the default Rails 4.2 behavior of converting it to
+ a UTC timestamp string.
+
+ Fixes #26296.
+
+ *Andrew White*
+
+* Fix `ActiveSupport::TimeWithZone#in` across DST boundaries.
+
+ Previously calls to `in` were being sent to the non-DST aware
+ method `Time#since` via `method_missing`. It is now aliased to
+ the DST aware `ActiveSupport::TimeWithZone#since` which handles
+ transitions across DST boundaries, e.g:
+
+ Time.zone = "US/Eastern"
+
+ t = Time.zone.local(2016,11,6,1)
+ # => Sun, 06 Nov 2016 01:00:00 EDT -05:00
+
+ t.in(1.hour)
+ # => Sun, 06 Nov 2016 01:00:00 EST -05:00
+
+ Fixes #26580.
+
+ *Thomas Balthazar*
+
+
## Rails 4.2.7 (July 12, 2016) ##
* Fixed `ActiveSupport::Logger.broadcast` so that calls to `#silence` now
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/mem_cache_store.rb
new/lib/active_support/cache/mem_cache_store.rb
--- old/lib/active_support/cache/mem_cache_store.rb 2016-08-11
00:25:24.000000000 +0200
+++ new/lib/active_support/cache/mem_cache_store.rb 2017-02-21
17:06:59.000000000 +0100
@@ -67,7 +67,7 @@
options = names.extract_options!
options = merged_options(options)
keys_to_names = Hash[names.map{|name| [escape_key(namespaced_key(name,
options)), name]}]
- raw_values = @data.get_multi(keys_to_names.keys, :raw => true)
+ raw_values = @data.get_multi(keys_to_names.keys)
values = {}
raw_values.each do |key, value|
entry = deserialize_entry(value)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/core_ext/class/subclasses.rb
new/lib/active_support/core_ext/class/subclasses.rb
--- old/lib/active_support/core_ext/class/subclasses.rb 2016-08-11
00:25:24.000000000 +0200
+++ new/lib/active_support/core_ext/class/subclasses.rb 2017-02-21
17:06:59.000000000 +0100
@@ -25,8 +25,6 @@
# Returns an array with the direct children of +self+.
#
- # Integer.subclasses # => [Fixnum, Bignum]
- #
# class Foo; end
# class Bar < Foo; end
# class Baz < Bar; 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
1970-01-01 01:00:00.000000000 +0100
+++ new/lib/active_support/core_ext/date_and_time/compatibility.rb
2017-02-21 17:06:59.000000000 +0100
@@ -0,0 +1,29 @@
+require 'active_support/core_ext/module/attribute_accessors'
+require 'active_support/core_ext/module/remove_method'
+
+module DateAndTime
+ module Compatibility
+ # If true, +to_time+ preserves the timezone offset of receiver.
+ #
+ # NOTE: With Ruby 2.4+ the default for +to_time+ changed from
+ # converting to the local system time, to preserving the offset
+ # of the receiver. For backwards compatibility we're overriding
+ # 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 self.included(base)
+ base.class_eval do
+ remove_possible_method :to_time
+
+ 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
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_support/core_ext/date_time/calculations.rb
new/lib/active_support/core_ext/date_time/calculations.rb
--- old/lib/active_support/core_ext/date_time/calculations.rb 2016-08-11
00:25:24.000000000 +0200
+++ new/lib/active_support/core_ext/date_time/calculations.rb 2017-02-21
17:06:59.000000000 +0100
@@ -24,6 +24,13 @@
end_of_day.to_i - to_i
end
+ # Returns the fraction of a second as a +Rational+
+ #
+ # DateTime.new(2012, 8, 29, 0, 0, 0.5).subsec # => (1/2)
+ def subsec
+ sec_fraction
+ end
+
# Returns a new DateTime where one or more of the elements have been changed
# according to the +options+ parameter. The time options (<tt>:hour</tt>,
# <tt>:min</tt>, <tt>:sec</tt>) reset cascadingly, so if only the hour is
@@ -139,14 +146,32 @@
end
alias :at_end_of_minute :end_of_minute
- # Adjusts DateTime to UTC by adding its offset value; offset is set to 0.
+ # Returns a <tt>Time</tt> instance of the simultaneous time in the system
timezone.
+ def localtime(utc_offset = nil)
+ utc = new_offset(0)
+
+ Time.utc(
+ utc.year, utc.month, utc.day,
+ utc.hour, utc.min, utc.sec + utc.sec_fraction
+ ).getlocal(utc_offset)
+ end
+ alias_method :getlocal, :localtime
+
+ # Returns a <tt>Time</tt> instance of the simultaneous time in the UTC
timezone.
#
# DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)) # => Mon,
21 Feb 2005 10:11:12 -0600
- # DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)).utc # => Mon,
21 Feb 2005 16:11:12 +0000
+ # DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)).utc # => Mon,
21 Feb 2005 16:11:12 UTC
def utc
- new_offset(0)
+ utc = new_offset(0)
+
+ Time.utc(
+ utc.year, utc.month, utc.day,
+ utc.hour, utc.min, utc.sec + utc.sec_fraction
+ )
end
+ alias_method :getgm, :utc
alias_method :getutc, :utc
+ alias_method :gmtime, :utc
# Returns +true+ if <tt>offset == 0</tt>.
def utc?
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 1970-01-01
01:00:00.000000000 +0100
+++ new/lib/active_support/core_ext/date_time/compatibility.rb 2017-02-21
17:06:59.000000000 +0100
@@ -0,0 +1,5 @@
+require 'active_support/core_ext/date_and_time/compatibility'
+
+class DateTime
+ include DateAndTime::Compatibility
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/core_ext/date_time.rb
new/lib/active_support/core_ext/date_time.rb
--- old/lib/active_support/core_ext/date_time.rb 2016-08-11
00:25:24.000000000 +0200
+++ new/lib/active_support/core_ext/date_time.rb 2017-02-21
17:06:59.000000000 +0100
@@ -1,4 +1,5 @@
require 'active_support/core_ext/date_time/acts_like'
require 'active_support/core_ext/date_time/calculations'
+require 'active_support/core_ext/date_time/compatibility'
require 'active_support/core_ext/date_time/conversions'
require 'active_support/core_ext/date_time/zones'
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 2016-08-11
00:25:24.000000000 +0200
+++ new/lib/active_support/core_ext/enumerable.rb 2017-02-21
17:06:59.000000000 +0100
@@ -78,3 +78,19 @@
end
end
end
+
+# Array#sum was added in Ruby 2.4 but it only works with Numeric elements.
+#
+# 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 Array.instance_methods(false).include?(:sum) && !(%w[a].sum rescue false)
+ class Array
+ remove_method :sum
+
+ def sum(*args) #:nodoc:
+ # Use Enumerable#sum instead.
+ super
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/core_ext/hash/compact.rb
new/lib/active_support/core_ext/hash/compact.rb
--- old/lib/active_support/core_ext/hash/compact.rb 2016-08-11
00:25:24.000000000 +0200
+++ new/lib/active_support/core_ext/hash/compact.rb 2017-02-21
17:06:59.000000000 +0100
@@ -1,20 +1,24 @@
class Hash
- # Returns a hash with non +nil+ values.
- #
- # hash = { a: true, b: false, c: nil}
- # hash.compact # => { a: true, b: false}
- # hash # => { a: true, b: false, c: nil}
- # { c: nil }.compact # => {}
- def compact
- self.select { |_, value| !value.nil? }
+ unless Hash.instance_methods(false).include?(:compact)
+ # Returns a hash with non +nil+ values.
+ #
+ # hash = { a: true, b: false, c: nil}
+ # hash.compact # => { a: true, b: false}
+ # hash # => { a: true, b: false, c: nil}
+ # { c: nil }.compact # => {}
+ def compact
+ self.select { |_, value| !value.nil? }
+ end
end
- # Replaces current hash with non +nil+ values.
- #
- # hash = { a: true, b: false, c: nil}
- # hash.compact! # => { a: true, b: false}
- # hash # => { a: true, b: false}
- def compact!
- self.reject! { |_, value| value.nil? }
+ unless Hash.instance_methods(false).include?(:compact!)
+ # Replaces current hash with non +nil+ values.
+ #
+ # hash = { a: true, b: false, c: nil}
+ # hash.compact! # => { a: true, b: false}
+ # hash # => { a: true, b: false}
+ def compact!
+ self.reject! { |_, value| value.nil? }
+ end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/core_ext/hash/conversions.rb
new/lib/active_support/core_ext/hash/conversions.rb
--- old/lib/active_support/core_ext/hash/conversions.rb 2016-08-11
00:25:24.000000000 +0200
+++ new/lib/active_support/core_ext/hash/conversions.rb 2017-02-21
17:06:59.000000000 +0100
@@ -55,8 +55,7 @@
#
# XML_TYPE_NAMES = {
# "Symbol" => "symbol",
- # "Fixnum" => "integer",
- # "Bignum" => "integer",
+ # "Integer" => "integer",
# "BigDecimal" => "decimal",
# "Float" => "float",
# "TrueClass" => "boolean",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/core_ext/hash/transform_values.rb
new/lib/active_support/core_ext/hash/transform_values.rb
--- old/lib/active_support/core_ext/hash/transform_values.rb 2016-08-11
00:25:24.000000000 +0200
+++ new/lib/active_support/core_ext/hash/transform_values.rb 2017-02-21
17:06:59.000000000 +0100
@@ -11,7 +11,7 @@
result[key] = yield(value)
end
result
- end
+ end unless method_defined? :transform_values
# Destructive +transform_values+
def transform_values!
@@ -19,5 +19,5 @@
each do |key, value|
self[key] = yield(value)
end
- end
+ end unless method_defined? :transform_values!
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/core_ext/numeric/conversions.rb
new/lib/active_support/core_ext/numeric/conversions.rb
--- old/lib/active_support/core_ext/numeric/conversions.rb 2016-08-11
00:25:24.000000000 +0200
+++ new/lib/active_support/core_ext/numeric/conversions.rb 2017-02-21
17:06:59.000000000 +0100
@@ -118,7 +118,15 @@
end
end
- [Float, Fixnum, Bignum, BigDecimal].each do |klass|
+ klasses = [Float, BigDecimal]
+ # Ruby 2.4+ unifies Fixnum & Bignum into Integer.
+ if 0.class == Integer
+ klasses << Integer
+ else
+ klasses << Fixnum << Bignum
+ end
+
+ klasses.each do |klass|
klass.send(:alias_method, :to_default_s, :to_s)
klass.send(:define_method, :to_s) do |*args|
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/core_ext/object/duplicable.rb
new/lib/active_support/core_ext/object/duplicable.rb
--- old/lib/active_support/core_ext/object/duplicable.rb 2016-08-11
00:25:24.000000000 +0200
+++ new/lib/active_support/core_ext/object/duplicable.rb 2017-02-21
17:06:59.000000000 +0100
@@ -1,7 +1,7 @@
#--
-# Most objects are cloneable, but not all. For example you can't dup +nil+:
+# Most objects are cloneable, but not all. For example you can't dup methods:
#
-# nil.dup # => TypeError: can't dup NilClass
+# method(:puts).dup # => TypeError: allocator undefined for Method
#
# Classes may signal their instances are not duplicable removing +dup+/+clone+
# or raising exceptions from them. So, to dup an arbitrary object you normally
@@ -27,52 +27,78 @@
end
class NilClass
- # +nil+ is not duplicable:
- #
- # nil.duplicable? # => false
- # nil.dup # => TypeError: can't dup NilClass
- def duplicable?
- false
+ begin
+ nil.dup
+ rescue TypeError
+
+ # +nil+ is not duplicable:
+ #
+ # nil.duplicable? # => false
+ # nil.dup # => TypeError: can't dup NilClass
+ def duplicable?
+ false
+ end
end
end
class FalseClass
- # +false+ is not duplicable:
- #
- # false.duplicable? # => false
- # false.dup # => TypeError: can't dup FalseClass
- def duplicable?
- false
+ begin
+ false.dup
+ rescue TypeError
+
+ # +false+ is not duplicable:
+ #
+ # false.duplicable? # => false
+ # false.dup # => TypeError: can't dup FalseClass
+ def duplicable?
+ false
+ end
end
end
class TrueClass
- # +true+ is not duplicable:
- #
- # true.duplicable? # => false
- # true.dup # => TypeError: can't dup TrueClass
- def duplicable?
- false
+ begin
+ true.dup
+ rescue TypeError
+
+ # +true+ is not duplicable:
+ #
+ # true.duplicable? # => false
+ # true.dup # => TypeError: can't dup TrueClass
+ def duplicable?
+ false
+ end
end
end
class Symbol
- # Symbols are not duplicable:
- #
- # :my_symbol.duplicable? # => false
- # :my_symbol.dup # => TypeError: can't dup Symbol
- def duplicable?
- false
+ begin
+ :symbol.dup # Ruby 2.4.x.
+ 'symbol_from_string'.to_sym.dup # Some symbols can't `dup` in Ruby 2.4.0.
+ rescue TypeError
+
+ # Symbols are not duplicable:
+ #
+ # :my_symbol.duplicable? # => false
+ # :my_symbol.dup # => TypeError: can't dup Symbol
+ def duplicable?
+ false
+ end
end
end
class Numeric
- # Numbers are not duplicable:
- #
- # 3.duplicable? # => false
- # 3.dup # => TypeError: can't dup Fixnum
- def duplicable?
- false
+ begin
+ 1.dup
+ rescue TypeError
+
+ # Numbers are not duplicable:
+ #
+ # 3.duplicable? # => false
+ # 3.dup # => TypeError: can't dup Integer
+ def duplicable?
+ false
+ end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/core_ext/string/access.rb
new/lib/active_support/core_ext/string/access.rb
--- old/lib/active_support/core_ext/string/access.rb 2016-08-11
00:25:24.000000000 +0200
+++ new/lib/active_support/core_ext/string/access.rb 2017-02-21
17:06:59.000000000 +0100
@@ -1,5 +1,5 @@
class String
- # If you pass a single Fixnum, returns a substring of one character at that
+ # If you pass a single integer, returns a substring of one character at that
# position. The first character of the string is at position 0, the next at
# position 1, and so on. If a range is supplied, a substring containing
# characters at offsets given by the range is returned. In both cases, if an
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/core_ext/string/conversions.rb
new/lib/active_support/core_ext/string/conversions.rb
--- old/lib/active_support/core_ext/string/conversions.rb 2016-08-11
00:25:24.000000000 +0200
+++ new/lib/active_support/core_ext/string/conversions.rb 2017-02-21
17:06:59.000000000 +0100
@@ -31,7 +31,7 @@
parts.fetch(:offset, form == :utc ? 0 : nil)
)
- form == :utc ? time.utc : time.getlocal
+ form == :utc ? time.utc : time.to_time
end
# Converts a string to a Date value.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/core_ext/time/calculations.rb
new/lib/active_support/core_ext/time/calculations.rb
--- old/lib/active_support/core_ext/time/calculations.rb 2016-08-11
00:25:24.000000000 +0200
+++ new/lib/active_support/core_ext/time/calculations.rb 2017-02-21
17:06:59.000000000 +0100
@@ -63,6 +63,13 @@
end_of_day.to_i - to_i
end
+ # Returns the fraction of a second as a +Rational+
+ #
+ # Time.new(2012, 8, 29, 0, 0, 0.5).sec_fraction # => (1/2)
+ def sec_fraction
+ subsec
+ end
+
# Returns a new Time where one or more of the elements have been changed
according
# to the +options+ parameter. The time options (<tt>:hour</tt>,
<tt>:min</tt>,
# <tt>:sec</tt>, <tt>:usec</tt>, <tt>:nsec</tt>) reset cascadingly, so if
only
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 1970-01-01
01:00:00.000000000 +0100
+++ new/lib/active_support/core_ext/time/compatibility.rb 2017-02-21
17:06:59.000000000 +0100
@@ -0,0 +1,5 @@
+require 'active_support/core_ext/date_and_time/compatibility'
+
+class Time
+ include DateAndTime::Compatibility
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/core_ext/time.rb
new/lib/active_support/core_ext/time.rb
--- old/lib/active_support/core_ext/time.rb 2016-08-11 00:25:24.000000000
+0200
+++ new/lib/active_support/core_ext/time.rb 2017-02-21 17:06:59.000000000
+0100
@@ -1,5 +1,6 @@
require 'active_support/core_ext/time/acts_like'
require 'active_support/core_ext/time/calculations'
+require 'active_support/core_ext/time/compatibility'
require 'active_support/core_ext/time/conversions'
require 'active_support/core_ext/time/marshal'
require 'active_support/core_ext/time/zones'
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 2016-08-11 00:25:24.000000000
+0200
+++ new/lib/active_support/gem_version.rb 2017-02-21 17:06:59.000000000
+0100
@@ -7,8 +7,8 @@
module VERSION
MAJOR = 4
MINOR = 2
- TINY = 7
- PRE = "1"
+ TINY = 8
+ PRE = nil
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/hash_with_indifferent_access.rb
new/lib/active_support/hash_with_indifferent_access.rb
--- old/lib/active_support/hash_with_indifferent_access.rb 2016-08-11
00:25:24.000000000 +0200
+++ new/lib/active_support/hash_with_indifferent_access.rb 2017-02-21
17:06:59.000000000 +0100
@@ -245,6 +245,11 @@
dup.tap { |hash| hash.reject!(*args, &block) }
end
+ def transform_values(*args, &block)
+ return to_enum(:transform_values) unless block_given?
+ dup.tap { |hash| hash.transform_values!(*args, &block) }
+ end
+
# Convert to a regular hash with string keys.
def to_hash
_new_hash = Hash.new
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/message_encryptor.rb
new/lib/active_support/message_encryptor.rb
--- old/lib/active_support/message_encryptor.rb 2016-08-11 00:25:24.000000000
+0200
+++ new/lib/active_support/message_encryptor.rb 2017-02-21 17:06:59.000000000
+0100
@@ -18,6 +18,8 @@
# encrypted_data = crypt.encrypt_and_sign('my secret data') #
=> "NlFBTTMwOUV5UlA1QlNEN2xkY2d6eThYWWh..."
# crypt.decrypt_and_verify(encrypted_data) #
=> "my secret data"
class MessageEncryptor
+ DEFAULT_CIPHER = "aes-256-cbc"
+
module NullSerializer #:nodoc:
def self.load(value)
value
@@ -64,6 +66,11 @@
_decrypt(verifier.verify(value))
end
+ # Given a cipher, returns the key length of the cipher to help generate
the key of desired size
+ def self.key_len(cipher = DEFAULT_CIPHER)
+ OpenSSL::Cipher.new(cipher).key_len
+ end
+
private
def _encrypt(value)
@@ -97,7 +104,7 @@
end
def new_cipher
- OpenSSL::Cipher::Cipher.new(@cipher)
+ OpenSSL::Cipher.new(@cipher)
end
def verifier
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 2016-08-11
00:25:24.000000000 +0200
+++ new/lib/active_support/testing/time_helpers.rb 2017-02-21
17:06:59.000000000 +0100
@@ -7,7 +7,7 @@
@stubs = {}
end
- def stub_object(object, method_name, return_value)
+ def stub_object(object, method_name, &block)
key = [object.object_id, method_name]
if stub = @stubs[key]
@@ -19,7 +19,7 @@
@stubs[key] = Stub.new(object, method_name, new_name)
object.singleton_class.send :alias_method, new_name, method_name
- object.define_singleton_method(method_name) { return_value }
+ object.define_singleton_method(method_name, &block)
end
def unstub_all!
@@ -97,8 +97,9 @@
now = date_or_time.to_time.change(usec: 0)
end
- simple_stubs.stub_object(Time, :now, now)
- simple_stubs.stub_object(Date, :today, now.to_date)
+ simple_stubs.stub_object(Time, :now) { at(now.to_i) }
+ simple_stubs.stub_object(Date, :today) { jd(now.to_date.jd) }
+ simple_stubs.stub_object(DateTime, :now) { jd(now.to_date.jd,
now.hour, now.min, now.sec, Rational(now.utc_offset, 86400)) }
if block_given?
begin
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 2016-08-11 00:25:24.000000000
+0200
+++ new/lib/active_support/time_with_zone.rb 2017-02-21 17:06:59.000000000
+0100
@@ -1,5 +1,6 @@
require 'active_support/values/time_zone'
require 'active_support/core_ext/object/acts_like'
+require 'active_support/core_ext/date_and_time/compatibility'
module ActiveSupport
# A Time-like class that can represent a time in any time zone. Necessary
@@ -40,20 +41,21 @@
'Time'
end
- include Comparable
+ include Comparable, DateAndTime::Compatibility
attr_reader :time_zone
def initialize(utc_time, time_zone, local_time = nil, period = nil)
- @utc, @time_zone, @time = utc_time, time_zone, local_time
+ @utc = utc_time ? transfer_time_values_to_utc_constructor(utc_time) : nil
+ @time_zone, @time = time_zone, local_time
@period = @utc ? period : get_period_and_ensure_valid_local_time(period)
end
- # Returns a Time or DateTime instance that represents the time in
+time_zone+.
+ # Returns a <tt>Time</tt> instance that represents the time in +time_zone+.
def time
@time ||= period.to_local(@utc)
end
- # Returns a Time or DateTime instance that represents the time in UTC.
+ # Returns a <tt>Time</tt> instance of the simultaneous time in the UTC
timezone.
def utc
@utc ||= period.to_utc(@time)
end
@@ -73,10 +75,9 @@
utc.in_time_zone(new_zone)
end
- # Returns a <tt>Time.local()</tt> instance of the simultaneous time in your
- # system's <tt>ENV['TZ']</tt> zone.
+ # Returns a <tt>Time</tt> instance of the simultaneous time in the system
timezone.
def localtime(utc_offset = nil)
- utc.respond_to?(:getlocal) ? utc.getlocal(utc_offset) :
utc.to_time.getlocal(utc_offset)
+ utc.getlocal(utc_offset)
end
alias_method :getlocal, :localtime
@@ -160,7 +161,11 @@
end
end
- def encode_with(coder)
+ def init_with(coder) #:nodoc:
+ initialize(coder['utc'], coder['zone'], coder['time'])
+ end
+
+ def encode_with(coder) #:nodoc:
if coder.respond_to?(:represent_object)
coder.represent_object(nil, utc)
else
@@ -276,6 +281,7 @@
utc.since(other).in_time_zone(time_zone)
end
end
+ alias_method :in, :since
def ago(other)
since(-other)
@@ -316,13 +322,8 @@
utc.to_r
end
- # Return an instance of Time in the system timezone.
- def to_time
- utc.to_time
- end
-
def to_datetime
- utc.to_datetime.new_offset(Rational(utc_offset, 86_400))
+ @to_datetime ||= utc.to_datetime.new_offset(Rational(utc_offset, 86_400))
end
# So that +self+ <tt>acts_like?(:time)</tt>.
@@ -360,7 +361,6 @@
# Ensure proxy class responds to all methods that underlying time instance
# responds to.
def respond_to_missing?(sym, include_priv)
- # consistently respond false to acts_like?(:date), regardless of whether
#time is a Time or DateTime
return false if sym.to_sym == :acts_like_date?
time.respond_to?(sym, include_priv)
end
@@ -388,7 +388,7 @@
end
def transfer_time_values_to_utc_constructor(time)
- ::Time.utc(time.year, time.month, time.day, time.hour, time.min,
time.sec, Rational(time.nsec, 1000))
+ ::Time.utc(time.year, time.month, time.day, time.hour, time.min,
time.sec + time.subsec)
end
def duration_of_variable_length?(obj)
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 2016-08-11 00:25:24.000000000
+0200
+++ new/lib/active_support/values/time_zone.rb 2017-02-21 17:06:59.000000000
+0100
@@ -273,6 +273,10 @@
@tzinfo = tzinfo || TimeZone.find_tzinfo(name)
end
+ def init_with(coder) #:nodoc:
+ initialize(coder['name'])
+ end
+
# Returns the offset of this time zone from UTC in seconds.
def utc_offset
if @utc_offset
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support/xml_mini.rb
new/lib/active_support/xml_mini.rb
--- old/lib/active_support/xml_mini.rb 2016-08-11 00:25:25.000000000 +0200
+++ new/lib/active_support/xml_mini.rb 2017-02-21 17:06:59.000000000 +0100
@@ -32,20 +32,25 @@
"binary" => "base64"
} unless defined?(DEFAULT_ENCODINGS)
- TYPE_NAMES = {
- "Symbol" => "symbol",
- "Fixnum" => "integer",
- "Bignum" => "integer",
- "BigDecimal" => "decimal",
- "Float" => "float",
- "TrueClass" => "boolean",
- "FalseClass" => "boolean",
- "Date" => "date",
- "DateTime" => "dateTime",
- "Time" => "dateTime",
- "Array" => "array",
- "Hash" => "hash"
- } unless defined?(TYPE_NAMES)
+ unless defined?(TYPE_NAMES)
+ TYPE_NAMES = {
+ "Symbol" => "symbol",
+ "Integer" => "integer",
+ "BigDecimal" => "decimal",
+ "Float" => "float",
+ "TrueClass" => "boolean",
+ "FalseClass" => "boolean",
+ "Date" => "date",
+ "DateTime" => "dateTime",
+ "Time" => "dateTime",
+ "Array" => "array",
+ "Hash" => "hash"
+ }
+
+ # No need to map these on Ruby 2.4+
+ TYPE_NAMES["Fixnum"] = "integer" unless 0.class == Integer
+ TYPE_NAMES["Bignum"] = "integer" unless 0.class == Integer
+ end
FORMATTING = {
"symbol" => Proc.new { |symbol| symbol.to_s },
@@ -63,7 +68,17 @@
"datetime" => Proc.new { |time| Time.xmlschema(time).utc rescue
::DateTime.parse(time).utc },
"integer" => Proc.new { |integer| integer.to_i },
"float" => Proc.new { |float| float.to_f },
- "decimal" => Proc.new { |number| BigDecimal(number) },
+ "decimal" => Proc.new do |number|
+ if String === number
+ begin
+ BigDecimal(number)
+ rescue ArgumentError
+ BigDecimal('0')
+ end
+ else
+ BigDecimal(number)
+ end
+ end,
"boolean" => Proc.new { |boolean| %w(1
true).include?(boolean.to_s.strip) },
"string" => Proc.new { |string| string.to_s },
"yaml" => Proc.new { |yaml| YAML::load(yaml) rescue yaml },
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_support.rb new/lib/active_support.rb
--- old/lib/active_support.rb 2016-08-11 00:25:24.000000000 +0200
+++ new/lib/active_support.rb 2017-02-21 17:06:59.000000000 +0100
@@ -26,6 +26,7 @@
require "active_support/version"
require "active_support/logger"
require "active_support/lazy_load_hooks"
+require "active_support/core_ext/date_and_time/compatibility"
module ActiveSupport
extend ActiveSupport::Autoload
@@ -80,6 +81,14 @@
def self.test_order # :nodoc:
@@test_order
end
+
+ def self.to_time_preserves_timezone
+ DateAndTime::Compatibility.preserve_timezone
+ end
+
+ def self.to_time_preserves_timezone=(value)
+ DateAndTime::Compatibility.preserve_timezone = value
+ end
end
autoload :I18n, "active_support/i18n"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2016-08-11 00:25:24.000000000 +0200
+++ new/metadata 2017-02-21 17:06:59.000000000 +0100
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: activesupport
version: !ruby/object:Gem::Version
- version: 4.2.7.1
+ version: 4.2.8
platform: ruby
authors:
- David Heinemeier Hansson
autorequire:
bindir: bin
cert_chain: []
-date: 2016-08-10 00:00:00.000000000 Z
+date: 2017-02-21 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: i18n
@@ -25,26 +25,6 @@
- !ruby/object:Gem::Version
version: '0.7'
- !ruby/object:Gem::Dependency
- name: json
- requirement: !ruby/object:Gem::Requirement
- requirements:
- - - "~>"
- - !ruby/object:Gem::Version
- version: '1.7'
- - - ">="
- - !ruby/object:Gem::Version
- version: 1.7.7
- type: :runtime
- prerelease: false
- version_requirements: !ruby/object:Gem::Requirement
- requirements:
- - - "~>"
- - !ruby/object:Gem::Version
- version: '1.7'
- - - ">="
- - !ruby/object:Gem::Version
- version: 1.7.7
-- !ruby/object:Gem::Dependency
name: tzinfo
requirement: !ruby/object:Gem::Requirement
requirements:
@@ -142,10 +122,12 @@
- lib/active_support/core_ext/date/conversions.rb
- lib/active_support/core_ext/date/zones.rb
- lib/active_support/core_ext/date_and_time/calculations.rb
+- lib/active_support/core_ext/date_and_time/compatibility.rb
- lib/active_support/core_ext/date_and_time/zones.rb
- lib/active_support/core_ext/date_time.rb
- lib/active_support/core_ext/date_time/acts_like.rb
- lib/active_support/core_ext/date_time/calculations.rb
+- lib/active_support/core_ext/date_time/compatibility.rb
- lib/active_support/core_ext/date_time/conversions.rb
- lib/active_support/core_ext/date_time/zones.rb
- lib/active_support/core_ext/digest/uuid.rb
@@ -231,6 +213,7 @@
- lib/active_support/core_ext/time.rb
- lib/active_support/core_ext/time/acts_like.rb
- lib/active_support/core_ext/time/calculations.rb
+- lib/active_support/core_ext/time/compatibility.rb
- lib/active_support/core_ext/time/conversions.rb
- lib/active_support/core_ext/time/marshal.rb
- lib/active_support/core_ext/time/zones.rb
@@ -340,10 +323,9 @@
version: '0'
requirements: []
rubyforge_project:
-rubygems_version: 2.6.6
+rubygems_version: 2.6.10
signing_key:
specification_version: 4
summary: A toolkit of support libraries and Ruby core extensions extracted
from the
Rails framework.
test_files: []
-has_rdoc: