Class: MetadataPresenter::MaxSizeValidator
- Inherits:
-
UploadValidator
- Object
- BaseValidator
- UploadValidator
- MetadataPresenter::MaxSizeValidator
- Defined in:
- app/validators/metadata_presenter/max_size_validator.rb
Instance Attribute Summary
Attributes inherited from BaseValidator
Instance Method Summary collapse
Methods inherited from UploadValidator
#invalid_answer?, #user_answer
Methods inherited from BaseValidator
#allow_blank?, #custom_error_message, #default_error_message, #initialize, #invalid_answer?, #schema_key, #user_answer, #valid?, #validation_value
Constructor Details
This class inherits a constructor from MetadataPresenter::BaseValidator
Instance Method Details
#error_message_hash ⇒ Object
7 8 9 10 11 |
# File 'app/validators/metadata_presenter/max_size_validator.rb', line 7 def super.merge( { schema_key.to_sym => human_max_size } ) end |
#error_name ⇒ Object
3 4 5 |
# File 'app/validators/metadata_presenter/max_size_validator.rb', line 3 def error_name 'invalid.too-large' end |
#human_max_size ⇒ Object
13 14 15 |
# File 'app/validators/metadata_presenter/max_size_validator.rb', line 13 def human_max_size (component.validation[schema_key].to_f / (1024.0 * 1024.0)).round end |