The best answer for the analogy "ruler : carpenter" is "gardener : shovel."
Here's the reasoning: A ruler is a tool commonly used by a carpenter, just as a shovel is a tool commonly used by a gardener. Both pairs illustrate a relationship where the first item is a tool used by the second item, making "gardener : shovel" the most fitting choice.
The other options do not establish a similar tool-to-profession relationship.