Writing image into a ruby file

hi all,

I remember (very) long time ago, there was some information posted about
loading an image into a ruby file. I am trying to look for the sniplet
of the code but couldn’t find anytying. Just wondering if anyone could
help.

This is some of the extract of the code:-

#I am trying to write the content of the icon into an include file.

def loadIcon(file)
begin
File.open(file, “rb”) do |f|
icon = FXICOIcon.new(getApp(), f.read)
end
icon
rescue
raise RuntimeError, “Couldn’t load icon: #{file}”
end
end

#I’m trying load ‘Australia-Flag.ico’ and store it as a constant
‘aus.rb’.
filename = ‘c:\FXRUbySample\Australia-Flag.ico’
icon75 = loadIcon(filename)

File.new(‘c:\FXRubySample\aus.rb’, ‘wb’)
File.open(‘c:\FXRubySample\aus.rb’,‘wb’) do |f|
#puts icon75
f.syswrite icon75
end

#none of the puts and syswrite works.