Class: MetadataPresenter::MinWordValidator

Inherits:
BaseValidator show all
Includes:
WordCount
Defined in:
app/validators/metadata_presenter/min_word_validator.rb

Instance Attribute Summary

Attributes inherited from BaseValidator

#component, #page_answers

Instance Method Summary collapse

Methods included from WordCount

#strip_punctuation, #strip_tags, #word_count

Methods inherited from BaseValidator

#allow_blank?, #custom_error_message, #default_error_message, #error_message_hash, #initialize, #schema_key, #user_answer, #valid?, #validation_value

Constructor Details

This class inherits a constructor from MetadataPresenter::BaseValidator

Instance Method Details

#invalid_answer?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'app/validators/metadata_presenter/min_word_validator.rb', line 5

def invalid_answer?
  Float(word_count(user_answer), exception: false) < Float(component.validation[schema_key], exception: false)
end