Class: Definition::Types::Keys::Conformer
- Inherits:
-
Object
- Object
- Definition::Types::Keys::Conformer
- Defined in:
- lib/definition/types/keys.rb
Instance Method Summary collapse
- #conform ⇒ Object
-
#initialize(definition, value) ⇒ Conformer
constructor
A new instance of Conformer.
Constructor Details
#initialize(definition, value) ⇒ Conformer
Returns a new instance of Conformer.
75 76 77 78 79 80 81 |
# File 'lib/definition/types/keys.rb', line 75 def initialize(definition, value) self.definition = definition self.value = value self.errors = [] @conform_result_value = {} # This will be the output value after conforming @not_conformed_value_keys = value.dup # Used to track which keys are left over in the end (unexpected keys) end |
Instance Method Details
#conform ⇒ Object
83 84 85 86 87 88 89 90 |
# File 'lib/definition/types/keys.rb', line 83 def conform return invalid_input_result unless valid_input_type? values = conform_all_keys add_extra_key_errors unless definition.ignore_extra_keys ConformResult.new(values, errors: errors) end |