Class: Stannum::ParameterValidation::MethodValidations Private
- Inherits:
-
Module
- Object
- Module
- Stannum::ParameterValidation::MethodValidations
- Defined in:
- lib/stannum/parameter_validation.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Base class for modules that handle tracking validated methods.
Instance Method Summary collapse
- #add_contract(method_name, contract) ⇒ Object private
-
#contracts ⇒ Hash
private
The validation contracts defined for the class.
-
#initialize ⇒ MethodValidations
constructor
private
A new instance of MethodValidations.
- #own_contracts ⇒ Object private
Constructor Details
#initialize ⇒ MethodValidations
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of MethodValidations.
81 82 83 84 85 |
# File 'lib/stannum/parameter_validation.rb', line 81 def initialize super @contracts = {} end |
Instance Method Details
#add_contract(method_name, contract) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
88 89 90 |
# File 'lib/stannum/parameter_validation.rb', line 88 def add_contract(method_name, contract) @contracts[method_name] = contract end |
#contracts ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the validation contracts defined for the class.
93 94 95 96 97 98 99 100 |
# File 'lib/stannum/parameter_validation.rb', line 93 def contracts ancestors .select do |ancestor| ancestor.is_a? Stannum::ParameterValidation::MethodValidations end .map(&:own_contracts) .reduce(:merge) end |
#own_contracts ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
103 104 105 |
# File 'lib/stannum/parameter_validation.rb', line 103 def own_contracts @contracts end |