Ruby colors projects

Hello, I am new to ruby programming(like 4 classes of teaching). I am
writing a ruby script that extracts hexadecimal color codes out of a
Cascading Style Sheet (CSS) file. the script takes 2 command line
arguments. A location of css file and a filename to write out the
report. the script generates a html page that displays color swatches
with their RGB and hexadecimal values. I need help on how to open files
and match colors and output it in html page.

My code:[0], ‘r’) do |source|
source.each { |line|
puts line if line =~ /\h{3}/

regex to match color: /(?<=#)(?<!^)(\h{6}|\h{3})/

A sample CSS file:

.toggle button {
background-color: #dfdfdf;
color: #080808
.toggle button:hover {
background-color: #080808;
color: #ffffff;

.showSidebar {
position: absolute;
top: 20px;
right: 0;
display: none;

#primaryContent_2columns {
position: relative;
margin-right: 275px;
#secondaryContent_2columns {
float: right;
#header {
background-color: #0078f2;
padding: 20px 25px 0 25px;
border-bottom: 10px solid #0065cd;
#header h1 {
margin: 0;
font-weight: normal;
text-align: left;
color: #fff;
font-size: 40px;
line-height: 40px;
#header h2 {
margin: 0;
font-weight: normal;
text-align: left;
border-bottom: none;
color: #fff;

sample output

RGB: 255, 255, 255
Hex: #ffffff
RGB: 0, 101, 205
Hex: #0065cd
RGB: 238, 238, 238
Hex: #eeeeee