Class: CollectionJson::Serializer::Validation
- Inherits:
-
Object
- Object
- CollectionJson::Serializer::Validation
- Defined in:
- lib/collection_json_serializer/validator/base.rb,
lib/collection_json_serializer/validator/types/url.rb,
lib/collection_json_serializer/validator/types/value.rb
Direct Known Subclasses
Validator, CollectionJson::Serializer::Validator::ItemsValidator
Defined Under Namespace
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(serializer) ⇒ Validation
constructor
A new instance of Validation.
- #invalid? ⇒ Boolean
- #valid? ⇒ Boolean
Constructor Details
#initialize(serializer) ⇒ Validation
Returns a new instance of Validation.
6 7 8 9 10 |
# File 'lib/collection_json_serializer/validator/base.rb', line 6 def initialize(serializer) @serializer = serializer @errors = {} validate end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
4 5 6 |
# File 'lib/collection_json_serializer/validator/base.rb', line 4 def errors @errors end |
Instance Method Details
#invalid? ⇒ Boolean
16 17 18 |
# File 'lib/collection_json_serializer/validator/base.rb', line 16 def invalid? @errors.any? end |
#valid? ⇒ Boolean
12 13 14 |
# File 'lib/collection_json_serializer/validator/base.rb', line 12 def valid? !invalid? end |