Revert "Class#new also separates keyword arguments and optional hash"
This reverts commit 72c1aa21c1f88dbe4c60413fb937df41987068e5. This causes CI fails on Ruby < 2.7
This commit is contained in:
parent
de3d9680ac
commit
af99f45b58
@ -371,8 +371,10 @@ def group_by_attribute
|
||||
# person.errors.details
|
||||
# # => {:base=>[{error: :name_or_email_blank}]}
|
||||
def add(attribute, type = :invalid, **options)
|
||||
attribute, type, options = normalize_arguments(attribute, type, **options)
|
||||
error = Error.new(@base, attribute, type, **options)
|
||||
error = Error.new(
|
||||
@base,
|
||||
*normalize_arguments(attribute, type, **options)
|
||||
)
|
||||
|
||||
if exception = options[:strict]
|
||||
exception = ActiveModel::StrictValidationFailed if exception == true
|
||||
|
@ -422,7 +422,7 @@ def timestamps(**options)
|
||||
# See {connection.add_reference}[rdoc-ref:SchemaStatements#add_reference] for details of the options you can use.
|
||||
def references(*args, **options)
|
||||
args.each do |ref_name|
|
||||
ReferenceDefinition.new(ref_name, **options).add_to(self)
|
||||
ReferenceDefinition.new(ref_name, options).add_to(self)
|
||||
end
|
||||
end
|
||||
alias :belongs_to :references
|
||||
|
@ -10,7 +10,7 @@ def registry
|
||||
@registry ||= {}
|
||||
end
|
||||
|
||||
def new(*, **)
|
||||
def new(*)
|
||||
super.deduplicate
|
||||
end
|
||||
end
|
||||
|
@ -186,7 +186,7 @@ class TableDefinition < ActiveRecord::ConnectionAdapters::TableDefinition
|
||||
|
||||
attr_reader :unlogged
|
||||
|
||||
def initialize(*, **)
|
||||
def initialize(*)
|
||||
super
|
||||
@unlogged = ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.create_unlogged_tables
|
||||
end
|
||||
|
@ -110,8 +110,8 @@ def method_missing(method, *args, &block)
|
||||
end
|
||||
|
||||
module ClassMethods # :nodoc:
|
||||
def create(klass, *args, **options)
|
||||
relation_class_for(klass).new(klass, *args, **options)
|
||||
def create(klass, *args)
|
||||
relation_class_for(klass).new(klass, *args)
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -121,7 +121,7 @@ def warn(callstack, called, args)
|
||||
# (Backtrace information…)
|
||||
# ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"]
|
||||
class DeprecatedConstantProxy < Module
|
||||
def self.new(*args, **options, &block)
|
||||
def self.new(*args, &block)
|
||||
object = args.first
|
||||
|
||||
return object unless object
|
||||
|
@ -94,7 +94,7 @@ def read_key_file
|
||||
end
|
||||
|
||||
def handle_missing_key
|
||||
raise MissingKeyError.new(key_path: key_path, env_key: env_key) if raise_if_missing_key
|
||||
raise MissingKeyError, key_path: key_path, env_key: env_key if raise_if_missing_key
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -26,7 +26,7 @@ def decrypt_and_verify(*args, on_rotation: @on_rotation, **options)
|
||||
|
||||
private
|
||||
def build_rotation(secret = @secret, sign_secret = @sign_secret, options)
|
||||
self.class.new(secret, sign_secret, **options)
|
||||
self.class.new(secret, sign_secret, options)
|
||||
end
|
||||
end
|
||||
|
||||
@ -39,7 +39,7 @@ def verified(*args, on_rotation: @on_rotation, **options)
|
||||
|
||||
private
|
||||
def build_rotation(secret = @secret, options)
|
||||
self.class.new(secret, **options)
|
||||
self.class.new(secret, options)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -244,7 +244,7 @@ class MessageEncryptorMetadataTest < ActiveSupport::TestCase
|
||||
|
||||
setup do
|
||||
@secret = SecureRandom.random_bytes(32)
|
||||
@encryptor = ActiveSupport::MessageEncryptor.new(@secret, **encryptor_options)
|
||||
@encryptor = ActiveSupport::MessageEncryptor.new(@secret, encryptor_options)
|
||||
end
|
||||
|
||||
private
|
||||
@ -256,7 +256,7 @@ def parse(data, **options)
|
||||
@encryptor.decrypt_and_verify(data, **options)
|
||||
end
|
||||
|
||||
def encryptor_options; {} end
|
||||
def encryptor_options; end
|
||||
end
|
||||
|
||||
class MessageEncryptorMetadataMarshalTest < MessageEncryptorMetadataTest
|
||||
|
@ -142,7 +142,7 @@ class MessageVerifierMetadataTest < ActiveSupport::TestCase
|
||||
include SharedMessageMetadataTests
|
||||
|
||||
setup do
|
||||
@verifier = ActiveSupport::MessageVerifier.new("Hey, I'm a secret!", **verifier_options)
|
||||
@verifier = ActiveSupport::MessageVerifier.new("Hey, I'm a secret!", verifier_options)
|
||||
end
|
||||
|
||||
def test_verify_raises_when_purpose_differs
|
||||
|
Loading…
Reference in New Issue
Block a user