class RuboCop::AST::NodePattern::Compiler::SequenceSubcompiler

def compile_min_check

Returns:
  • (String) - code that evaluates to `false` if the matched arity is too small
def compile_min_check
  return 'false' unless node.variadic?
  unless @remaining_arity.end.infinite?
    not_too_much_remaining = "#{compile_remaining} <= #{@remaining_arity.max}"
  end
  min_to_match = node.arity_range.begin
  if min_to_match.positive?
    enough_matched = "#{compile_matched(:length)} >= #{min_to_match}"
  end
  return 'true' unless not_too_much_remaining || enough_matched
  [not_too_much_remaining, enough_matched].compact.join(' && ')
end