require 'rouge' # (1)

html = Rouge::Formatters::HTML.format(Rouge::Lexers::Ruby.lex('puts "Hello, world!"')) # (2)
puts html # (3) (4)
exit 0 # (5)(6)
  1. Load library

  2. Highlight source

  3. Print to stdout

  4. Redirect to a file to capture output

  5. Exit program

  6. Reports success