Class: Isomorfeus::Props::Validator
- Defined in:
- lib/isomorfeus/props/validator.rb
Instance Method Summary collapse
-
#initialize(source_class, prop, value, options) ⇒ Validator
constructor
A new instance of Validator.
- #validate! ⇒ Object
- #validated_value ⇒ Object
Constructor Details
#initialize(source_class, prop, value, options) ⇒ Validator
Returns a new instance of Validator.
4 5 6 7 8 9 |
# File 'lib/isomorfeus/props/validator.rb', line 4 def initialize(source_class, prop, value, ) @c = source_class @p = prop @v = value @o = end |
Instance Method Details
#validate! ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/isomorfeus/props/validator.rb', line 11 def validate! ensured = ensure! unless ensured set_default_value cast! type! end run_checks! true end |
#validated_value ⇒ Object
22 23 24 25 |
# File 'lib/isomorfeus/props/validator.rb', line 22 def validated_value validate! @v end |