Rename extract_passkey_component_options to partition_passkey_options

This commit is contained in:
Stanko K.R.
2026-03-25 16:34:57 +01:00
parent 693415bc71
commit f5ae2f8076
+3 -3
View File
@@ -30,7 +30,7 @@ module ActionPack::Passkey::FormHelper
# - All other options are passed to the +<button>+ tag # - All other options are passed to the +<button>+ tag
def passkey_registration_button(name = nil, url = nil, **options, &block) def passkey_registration_button(name = nil, url = nil, **options, &block)
url, name = name, block ? capture(&block) : nil if block_given? url, name = name, block ? capture(&block) : nil if block_given?
component_options, form_options, button_options, error_options = extract_passkey_component_options(url, options) component_options, form_options, button_options, error_options = partition_passkey_options(url, options)
error_options[:error][:message] ||= REGISTRATION_ERROR_MESSAGE error_options[:error][:message] ||= REGISTRATION_ERROR_MESSAGE
error_options[:cancellation][:message] ||= REGISTRATION_CANCELLED_MESSAGE error_options[:cancellation][:message] ||= REGISTRATION_CANCELLED_MESSAGE
param = form_options.delete(:param) param = form_options.delete(:param)
@@ -64,7 +64,7 @@ module ActionPack::Passkey::FormHelper
# - All other options are passed to the +<button>+ tag # - All other options are passed to the +<button>+ tag
def passkey_sign_in_button(name = nil, url = nil, **options, &block) def passkey_sign_in_button(name = nil, url = nil, **options, &block)
url, name = name, block ? capture(&block) : nil if block_given? url, name = name, block ? capture(&block) : nil if block_given?
component_options, form_options, button_options, error_options = extract_passkey_component_options(url, options) component_options, form_options, button_options, error_options = partition_passkey_options(url, options)
error_options[:error][:message] ||= SIGN_IN_ERROR_MESSAGE error_options[:error][:message] ||= SIGN_IN_ERROR_MESSAGE
error_options[:cancellation][:message] ||= SIGN_IN_CANCELLED_MESSAGE error_options[:cancellation][:message] ||= SIGN_IN_CANCELLED_MESSAGE
param = form_options.delete(:param) param = form_options.delete(:param)
@@ -82,7 +82,7 @@ module ActionPack::Passkey::FormHelper
end end
private private
def extract_passkey_component_options(url, options) def partition_passkey_options(url, options)
passkey_options = options.fetch(:options, {}) passkey_options = options.fetch(:options, {})
component_options = options component_options = options