Class: ValidifyMe::DataValidator::ParameterDefinition
- Inherits:
-
Object
- Object
- ValidifyMe::DataValidator::ParameterDefinition
- Defined in:
- lib/validify_me/data_validator.rb
Instance Attribute Summary collapse
-
#constraints ⇒ Object
readonly
Returns the value of attribute constraints.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, constraints) ⇒ ParameterDefinition
constructor
A new instance of ParameterDefinition.
- #value(type, **options) ⇒ Object
Constructor Details
#initialize(name, constraints) ⇒ ParameterDefinition
Returns a new instance of ParameterDefinition.
34 35 36 37 |
# File 'lib/validify_me/data_validator.rb', line 34 def initialize(name, constraints) @name = name @constraints = constraints end |
Instance Attribute Details
#constraints ⇒ Object (readonly)
Returns the value of attribute constraints.
32 33 34 |
# File 'lib/validify_me/data_validator.rb', line 32 def constraints @constraints end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
32 33 34 |
# File 'lib/validify_me/data_validator.rb', line 32 def name @name end |
Instance Method Details
#value(type, **options) ⇒ Object
39 40 41 42 |
# File 'lib/validify_me/data_validator.rb', line 39 def value(type, **) constraints[:type] = type constraints.merge!() end |