Extract `chain` helper method

This stops RuboCop complaining about method length.