Method: Attributor::Hash.validate

Defined in:
lib/attributor/types/hash.rb

.validate(object, context = Attributor::DEFAULT_ROOT_CONTEXT, _attribute) ⇒ Object



439
440
441
442
443
444
445
446
# File 'lib/attributor/types/hash.rb', line 439

def self.validate(object, context = Attributor::DEFAULT_ROOT_CONTEXT, _attribute)
  context = [context] if context.is_a? ::String

  unless object.is_a?(self)
    raise ArgumentError, "#{name} can not validate object of type #{object.class.name} for #{Attributor.humanize_context(context)}."
  end
  object.validate(context)
end