class ActiveValidation::Internal::Models::Check
Attributes
argument[R]
created_at[R]
method_name[R]
options[R]
Public Class Methods
new(method_name:, argument:, options: {}, created_at: nil, **_other)
click to toggle source
# File lib/active_validation/internal/models/check.rb, line 8 def initialize(method_name:, argument:, options: {}, created_at: nil, **_other) @method_name = registry.find_or_add method_name @argument = argument @options = options.to_h.deep_symbolize_keys @created_at = created_at end
Public Instance Methods
==(other)
click to toggle source
# File lib/active_validation/internal/models/check.rb, line 15 def ==(other) method_name == other.method_name && argument == other.argument && options == other.options end
as_json(only: %i[method_name argument options], **_options)
click to toggle source
# File lib/active_validation/internal/models/check.rb, line 25 def as_json(only: %i[method_name argument options], **_options) only.each_with_object({}) { |el, acc| acc[el.to_sym] = public_send(el).as_json } end
normalized_argument()
click to toggle source
# File lib/active_validation/internal/models/check.rb, line 33 def normalized_argument method_name.to_sym == :validates_with ? argument.to_s.constantize : argument.to_sym end
to_hash()
click to toggle source
# File lib/active_validation/internal/models/check.rb, line 21 def to_hash as_json end
to_internal_check()
click to toggle source
# File lib/active_validation/internal/models/check.rb, line 29 def to_internal_check self end
to_validation_arguments(context: nil)
click to toggle source
# File lib/active_validation/internal/models/check.rb, line 37 def to_validation_arguments(context: nil) [method_name.to_sym, normalized_argument, options.merge(on: context) { |_, old, new| Array(new) + Array(old) }] end
Private Instance Methods
registry()
click to toggle source
# File lib/active_validation/internal/models/check.rb, line 45 def registry ActiveValidation.config.method_name_values_registry end