ruby read file

# Step 1: Open the file in read-only mode
file_path = 'example.txt'
file = File.open(file_path, 'r')

# Step 2: Read the contents of the file
file_contents = file.read

# Step 3: Close the file to free up system resources
file.close