Class: Regexer::Utils::Handlers::QuantifierOptionsHandler::MinimumOptionHandler

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

Overview

A handler class to return the appropriate quantifier value if given the minimum option only

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



13
14
15
16
17
18
19
20
# File 'lib/regexer/utils/handlers/quantifier_options_handlers/minimum_option_handler.rb', line 13

def handle(value)
  if value.minimum && !value.maximum
    Regexer::Validators::ConsecutiveInstancesOfOptionsValueValidator.value_valid?(value.minimum)
    "{#{value.minimum},}"
  else
    give_to_next_handler(value)
  end
end