Class: Regexer::Utils::AnyCharacterInValueTransformer

Inherits:
Object
  • Object
show all
Defined in:
lib/regexer/utils/any_character_in_value_transformer.rb

Overview

A Utility Class that transforms a given value based on its types so that it is compatible with the has_any_character_in or has_any_character_not_in methods

Class Method Summary collapse

Class Method Details

.transform(value) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/regexer/utils/any_character_in_value_transformer.rb', line 15

def self.transform(value)
  basic_types_handler = ::Regexer::Utils::Handlers::AnyCharacterInInputValueHandlers::BasicTypesHandler.new
  from_to_hash_handler = ::Regexer::Utils::Handlers::AnyCharacterInInputValueHandlers::FromToHashHandler.new
  char_range_pattern_handler =
    ::Regexer::Utils::Handlers::AnyCharacterInInputValueHandlers::CharacterRangePatternHandler.new
  regex_shorthand_pattern_handler =
    ::Regexer::Utils::Handlers::AnyCharacterInInputValueHandlers::RegexShorthandPatternHandler.new

  basic_types_handler.next_handler(char_range_pattern_handler)
                     .next_handler(from_to_hash_handler)
                     .next_handler(regex_shorthand_pattern_handler)

  basic_types_handler.handle(value) || ""
end