Class: Regexer::Utils::Handlers::AnyCharacterInInputValueHandlers::BasicTypesHandler

Inherits:
Base
  • Object
show all
Defined in:
lib/regexer/utils/handlers/any_character_in_input_value_handlers/basic_types_handler.rb

Overview

A handler class to check if input value is one of the valid basic data types e.g. String, Integer, Float If its one of the basic types, just return a sanitized value for regex

Instance Method Summary collapse

Methods inherited from Base

#give_to_next_handler, #next_handler

Methods inherited from BaseHandler

#next_handler

Instance Method Details

#handle(value) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/regexer/utils/handlers/any_character_in_input_value_handlers/basic_types_handler.rb', line 15

def handle(value)
  if value.instance_of?(String) || value.instance_of?(Integer) || value.instance_of?(Float)
    Regexer::Utils::PatternSanitizer.sanitize(value)
  else
    give_to_next_handler(value)
  end
end