Q:

Ruby read a file, create a hash with a key and data, then sort alphabetically

I have a file like below, which I need to put into a hash:
GHIThree, Line, Number
DEFNumber, Two, Line
ABCLine, Number, One

I need to do is take the first 3 characters and turn that into a key and then the rest of the line into the value.
So when I print the hash it should look something like this:
Keys Values
ABC Line, Number, One
DEF Number, Two, Line
GHI Three, Line, Number

Here is what I've got, its a little all over the place but here it is:
lines = File.open("homework02.txt").read.split
fHash = {}
lines.each do |line|
  next if line == ""
  fHash[line[0..2]] = line[3..-1]
end

f = File.open("homework02.txt")
fHash = {}
loop do
  x = f.gets
  break unless x
  fHash[x[0..2]] = x[3..-1]
end

puts fHash

f.close

A:

fHash  =  fHash.to_a.sort.to_h

