This post originated from an RSS feed registered with Ruby Buzz
by Eric Hodel.
Original Post: mem_inspect and png
Feed Title: Segment7
Feed URL: http://blog.segment7.net/articles.rss
Feed Description: Posts about and around Ruby, MetaRuby, ruby2c, ZenTest and work at The Robot Co-op.
I'm pleased to announce to new libraries written by members of the Seattle Ruby Brigade, mem_inspect and png!
mem_inspect
mem_inspect is ObjectSpace.each_object on crack. mem_inspect gives you the contents of each slot in Ruby's heap. mem_inspect also includes viewers that let you visualize the contents of Ruby's heap.
To install:
sudo gem install mem_inspect
Then you'll need to build a patched ruby:
ruby_mem_inspect_build
You'll then have a ruby capable of running mem_inspect in mem_inspect_ruby_1_8.
png is a pure-ruby PNG writing library written by Ryan Davis.
To install:
sudo gem install png
To use:
require 'png'
canvas = PNG::Canvas.new 200, 200
# Set a point to a color
canvas[100, 100] = PNG::Color::Black
# draw an anti-aliased line
canvas.line 50, 50, 100, 50, PNG::Color::Blue
png = PNG.new canvas
png.save 'blah.png'