Exception: SuperModel::Error::HashType

Inherits:
Type show all
Defined in:
lib/super_model/error/hash_type.rb

Class Method Summary collapse

Methods inherited from Type

#to_s, valid_methods, valid_types

Class Method Details

.check(object, options = {}) ⇒ Object

Raises:

  • (self)


8
9
10
11
12
13
14
# File 'lib/super_model/error/hash_type.rb', line 8

def self.check(object, options={})
  super
  
  raise self unless options[:required_keys].is_a?(Array) && options[:required_keys].all? { |key| object.has_key?(key) }
  
  object
end