Hello community, here is the log from the commit of package rubygem-activemodel-5.2 for openSUSE:Factory checked in at 2019-04-01 12:36:06 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-activemodel-5.2 (Old) and /work/SRC/openSUSE:Factory/.rubygem-activemodel-5.2.new.25356 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-activemodel-5.2" Mon Apr 1 12:36:06 2019 rev:6 rq:689683 version:5.2.3 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-activemodel-5.2/rubygem-activemodel-5.2.changes 2019-03-14 15:03:35.399640769 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-activemodel-5.2.new.25356/rubygem-activemodel-5.2.changes 2019-04-01 12:36:11.349851183 +0200 @@ -1,0 +2,30 @@ +Fri Mar 29 05:52:27 UTC 2019 - Stephan Kulow <co...@suse.com> + +- updated to version 5.2.3 + see installed CHANGELOG.md + + ## Rails 5.2.3 (March 27, 2019) ## + + * Fix date value when casting a multiparameter date hash to not convert + from Gregorian date to Julian date. + + Before: + + Day.new({"day(1i)"=>"1", "day(2i)"=>"1", "day(3i)"=>"1"}) + => #<Day id: nil, day: "0001-01-03", created_at: nil, updated_at: nil> + + After: + + Day.new({"day(1i)"=>"1", "day(2i)"=>"1", "day(3i)"=>"1"}) + => #<Day id: nil, day: "0001-01-01", created_at: nil, updated_at: nil> + + Fixes #28521. + + *Sayan Chakraborty* + + * Fix numericality equality validation of `BigDecimal` and `Float` + by casting to `BigDecimal` on both ends of the validation. + + *Gannon McGibbon* + +------------------------------------------------------------------- Old: ---- activemodel-5.2.2.1.gem New: ---- activemodel-5.2.3.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-activemodel-5.2.spec ++++++ --- /var/tmp/diff_new_pack.YFQaVa/_old 2019-04-01 12:36:12.157851578 +0200 +++ /var/tmp/diff_new_pack.YFQaVa/_new 2019-04-01 12:36:12.157851578 +0200 @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -24,7 +24,7 @@ # Name: rubygem-activemodel-5.2 -Version: 5.2.2.1 +Version: 5.2.3 Release: 0 %define mod_name activemodel %define mod_full_name %{mod_name}-%{version} @@ -36,9 +36,9 @@ %endif # /MANUAL BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: ruby-macros >= 5 BuildRequires: %{ruby >= 2.2.2} BuildRequires: %{rubygem gem2rpm} +BuildRequires: ruby-macros >= 5 Url: http://rubyonrails.org Source: https://rubygems.org/gems/%{mod_full_name}.gem Source1: gem2rpm.yml ++++++ activemodel-5.2.2.1.gem -> activemodel-5.2.3.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md --- old/CHANGELOG.md 2019-03-13 17:46:57.000000000 +0100 +++ new/CHANGELOG.md 2019-03-28 03:59:23.000000000 +0100 @@ -1,3 +1,28 @@ +## Rails 5.2.3 (March 27, 2019) ## + +* Fix date value when casting a multiparameter date hash to not convert + from Gregorian date to Julian date. + + Before: + + Day.new({"day(1i)"=>"1", "day(2i)"=>"1", "day(3i)"=>"1"}) + => #<Day id: nil, day: "0001-01-03", created_at: nil, updated_at: nil> + + After: + + Day.new({"day(1i)"=>"1", "day(2i)"=>"1", "day(3i)"=>"1"}) + => #<Day id: nil, day: "0001-01-01", created_at: nil, updated_at: nil> + + Fixes #28521. + + *Sayan Chakraborty* + +* Fix numericality equality validation of `BigDecimal` and `Float` + by casting to `BigDecimal` on both ends of the validation. + + *Gannon McGibbon* + + ## Rails 5.2.2.1 (March 11, 2019) ## * No changes. 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_model/gem_version.rb new/lib/active_model/gem_version.rb --- old/lib/active_model/gem_version.rb 2019-03-13 17:46:57.000000000 +0100 +++ new/lib/active_model/gem_version.rb 2019-03-28 03:59:23.000000000 +0100 @@ -9,8 +9,8 @@ module VERSION MAJOR = 5 MINOR = 2 - TINY = 2 - PRE = "1" + TINY = 3 + PRE = nil STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/active_model/type/date.rb new/lib/active_model/type/date.rb --- old/lib/active_model/type/date.rb 2019-03-13 17:46:57.000000000 +0100 +++ new/lib/active_model/type/date.rb 2019-03-28 03:59:23.000000000 +0100 @@ -3,6 +3,7 @@ module ActiveModel module Type class Date < Value # :nodoc: + include Helpers::Timezone include Helpers::AcceptsMultiparameterTime.new def type @@ -49,7 +50,7 @@ def value_from_multiparameter_assignment(*) time = super - time && time.to_date + time && new_date(time.year, time.mon, time.mday) end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/active_model/type/date_time.rb new/lib/active_model/type/date_time.rb --- old/lib/active_model/type/date_time.rb 2019-03-13 17:46:57.000000000 +0100 +++ new/lib/active_model/type/date_time.rb 2019-03-28 03:59:23.000000000 +0100 @@ -3,6 +3,7 @@ module ActiveModel module Type class DateTime < Value # :nodoc: + include Helpers::Timezone include Helpers::TimeValue include Helpers::AcceptsMultiparameterTime.new( defaults: { 4 => 0, 5 => 0 } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/active_model/type/helpers/time_value.rb new/lib/active_model/type/helpers/time_value.rb --- old/lib/active_model/type/helpers/time_value.rb 2019-03-13 17:46:57.000000000 +0100 +++ new/lib/active_model/type/helpers/time_value.rb 2019-03-28 03:59:23.000000000 +0100 @@ -21,18 +21,6 @@ value end - def is_utc? - ::Time.zone_default.nil? || ::Time.zone_default =~ "UTC" - end - - def default_timezone - if is_utc? - :utc - else - :local - end - end - def apply_seconds_precision(value) return value unless precision && value.respond_to?(:usec) number_of_insignificant_digits = 6 - precision diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/active_model/type/helpers/timezone.rb new/lib/active_model/type/helpers/timezone.rb --- old/lib/active_model/type/helpers/timezone.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/active_model/type/helpers/timezone.rb 2019-03-28 03:59:23.000000000 +0100 @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +require "active_support/core_ext/time/zones" + +module ActiveModel + module Type + module Helpers # :nodoc: all + module Timezone + def is_utc? + ::Time.zone_default.nil? || ::Time.zone_default =~ "UTC" + end + + def default_timezone + is_utc? ? :utc : :local + end + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/active_model/type/helpers.rb new/lib/active_model/type/helpers.rb --- old/lib/active_model/type/helpers.rb 2019-03-13 17:46:57.000000000 +0100 +++ new/lib/active_model/type/helpers.rb 2019-03-28 03:59:23.000000000 +0100 @@ -4,3 +4,4 @@ require "active_model/type/helpers/numeric" require "active_model/type/helpers/mutable" require "active_model/type/helpers/time_value" +require "active_model/type/helpers/timezone" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/active_model/type/time.rb new/lib/active_model/type/time.rb --- old/lib/active_model/type/time.rb 2019-03-13 17:46:57.000000000 +0100 +++ new/lib/active_model/type/time.rb 2019-03-28 03:59:23.000000000 +0100 @@ -3,6 +3,7 @@ module ActiveModel module Type class Time < Value # :nodoc: + include Helpers::Timezone include Helpers::TimeValue include Helpers::AcceptsMultiparameterTime.new( defaults: { 1 => 1970, 2 => 1, 3 => 1, 4 => 0, 5 => 0 } @@ -12,6 +13,10 @@ :time end + def serialize(value) + super(cast(value)) + end + def user_input_in_time_zone(value) return unless value.present? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/active_model/validations/numericality.rb new/lib/active_model/validations/numericality.rb --- old/lib/active_model/validations/numericality.rb 2019-03-13 17:46:57.000000000 +0100 +++ new/lib/active_model/validations/numericality.rb 2019-03-28 03:59:23.000000000 +0100 @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "bigdecimal/util" + module ActiveModel module Validations class NumericalityValidator < EachValidator # :nodoc: @@ -9,6 +11,8 @@ RESERVED_OPTIONS = CHECKS.keys + [:only_integer] + INTEGER_REGEX = /\A[+-]?\d+\z/ + def check_validity! keys = CHECKS.keys - [:odd, :even] options.slice(*keys).each do |option, value| @@ -49,11 +53,7 @@ return end - if raw_value.is_a?(Numeric) - value = raw_value - else - value = parse_raw_value_as_a_number(raw_value) - end + value = parse_as_number(raw_value) options.slice(*CHECKS.keys).each do |option, option_value| case option @@ -69,6 +69,8 @@ option_value = record.send(option_value) end + option_value = parse_as_number(option_value) + unless value.send(CHECKS[option], option_value) record.errors.add(attr_name, option, filtered_options(value).merge!(count: option_value)) end @@ -79,22 +81,29 @@ private def is_number?(raw_value) - !parse_raw_value_as_a_number(raw_value).nil? + !parse_as_number(raw_value).nil? rescue ArgumentError, TypeError false end - def parse_raw_value_as_a_number(raw_value) - return raw_value.to_i if is_integer?(raw_value) - Kernel.Float(raw_value) unless is_hexadecimal_literal?(raw_value) + def parse_as_number(raw_value) + if raw_value.is_a?(Float) + raw_value.to_d + elsif raw_value.is_a?(Numeric) + raw_value + elsif is_integer?(raw_value) + raw_value.to_i + elsif !is_hexadecimal_literal?(raw_value) + Kernel.Float(raw_value).to_d + end end def is_integer?(raw_value) - /\A[+-]?\d+\z/ === raw_value.to_s + INTEGER_REGEX === raw_value.to_s end def is_hexadecimal_literal?(raw_value) - /\A0[xX]/ === raw_value + /\A0[xX]/ === raw_value.to_s end def filtered_options(value) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2019-03-13 17:46:57.000000000 +0100 +++ new/metadata 2019-03-28 03:59:23.000000000 +0100 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: activemodel version: !ruby/object:Gem::Version - version: 5.2.2.1 + version: 5.2.3 platform: ruby authors: - David Heinemeier Hansson autorequire: bindir: bin cert_chain: [] -date: 2019-03-13 00:00:00.000000000 Z +date: 2019-03-28 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: activesupport @@ -16,14 +16,14 @@ requirements: - - '=' - !ruby/object:Gem::Version - version: 5.2.2.1 + version: 5.2.3 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version - version: 5.2.2.1 + version: 5.2.3 description: A toolkit for building modeling frameworks like Active Record. Rich support for attributes, callbacks, validations, serialization, internationalization, and testing. @@ -73,6 +73,7 @@ - lib/active_model/type/helpers/mutable.rb - lib/active_model/type/helpers/numeric.rb - lib/active_model/type/helpers/time_value.rb +- lib/active_model/type/helpers/timezone.rb - lib/active_model/type/immutable_string.rb - lib/active_model/type/integer.rb - lib/active_model/type/registry.rb @@ -100,8 +101,8 @@ licenses: - MIT metadata: - source_code_uri: https://github.com/rails/rails/tree/v5.2.2.1/activemodel - changelog_uri: https://github.com/rails/rails/blob/v5.2.2.1/activemodel/CHANGELOG.md + source_code_uri: https://github.com/rails/rails/tree/v5.2.3/activemodel + changelog_uri: https://github.com/rails/rails/blob/v5.2.3/activemodel/CHANGELOG.md post_install_message: rdoc_options: [] require_paths: