First Install Jamis Buck's syntax gem
gem install syntax
Then create a file ruby2html.rb with the following content
#create a new ruby2Html-converter and convert clipboard-content to html
converter = Syntax::Convertors::HTML.for_syntax "ruby"
html_code = converter.convert(IO.popen('pbpaste', 'r+').read, false)
#wrap the code in a pre-tag with class 'ruby'
html_code = ["<pre class='ruby'>", html_code, "</pre>"].join
#output the generated html-code to the console
#write the html_code back to the clipboard
IO.popen('pbcopy', 'r+').puts html_code
Then just copy the content of the clipboard into your blog or webpage.
Warning: the code uses the cmd-line tools 'popen' and 'pbcopy' to access the clipboard. Those tools are MacOSX specific. If you're on Linux see this blog post, something similar for windows users is describe here.
Add this css declarations to the header of your web page (change them to fit your need):
/* Syntax highlighting */
If you need syntax highlighting for XML or HTML you can modify the ruby2html.rb to use the XML-Converter of the syntax gem.