Best way to open and edit a file in chef recipe

Hi guys,
I am new to chef and want to know which is the best way to open and edit a file and append a line to it in a chef automation ruby script.

Actually I want to edit a configuration file in a 'node' server machine using the recipe code.

Thanks

The is a cookbook with some nice resources for doing exactly this: https://supermarket.chef.io/cookbooks/line