class RuboCop::Cop::Metrics::Utils::CodeLengthCalculator

def build_foldable_checks(types)

def build_foldable_checks(types)
  types.map do |type|
    case type
    when :array
      ->(node) { node.array_type? }
    when :hash
      ->(node) { node.hash_type? }
    when :heredoc
      ->(node) { heredoc_node?(node) }
    else
      raise ArgumentError, "Unknown foldable type: #{type.inspect}. "\
                           "Valid foldable types are: #{FOLDABLE_TYPES.join(', ')}."
    end
  end
end