Class: Regexer::Validators::AnyCharacterInValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/regexer/validators/any_character_in_validator.rb

Overview

A Validator Class for validating values being passed to has_any_character_in Regexer::Pattern method

Class Method Summary collapse

Class Method Details

.value_valid?(value) ⇒ Boolean

Returns:

  • (Boolean)

Raises:



11
12
13
14
15
16
17
18
# File 'lib/regexer/validators/any_character_in_validator.rb', line 11

def self.value_valid?(value)
  char_range = "Regexer::Models::CharacterRangePattern"
  regex_shorthand_pattern = "Regexer::Models::Pattern as regex shorthand character"
  hash_model = "Hash with from & to keys"
  basic_types = "String, Integer, Float"
  message = "Value should be one of type #{basic_types}, #{char_range}, #{hash_model}, #{regex_shorthand_pattern}"
  raise Regexer::Exceptions::InvalidValueError, message unless valid?(value)
end