<p>I am trying to code a flowchart generator for a language using Ruby. </p>

<p>I wanted to know if there were any libraries that I could use to draw various shapes for the various flowchart elements and write out text to those shapes. </p>

<p>I would really prefer not having to write code for drawing basic shapes, if I can help it. </p>

<p>Can someone could point me to some reference documentation with examples of using that library?</p>

It sounds like you're going to be limited mainly by the capabilities of whatever user agent you're building for; if this is a web project, drawing capabilities are going to be dependent on the browser. Since Ruby is running server-side, you would at minimum need some JavaScript to allow dragging/zooming, etc. There's plenty of examples of JavaScript being used for vector drawing (just google "javascript graphics library"), but all require coding, and I haven't seen any library that abstracts this elegantly.
ImageMagick has a Ruby binding called RMagick (sometimes known by other names, depending on the repository). (
Link
)
I haven't used it myself, but I believe it will do what you're looking for. You will need to do some coding, but it's along the lines of
```
```
draw.rectangle(x1, y1, x2, y2)
draw.polygon(x1, y1,...,xN, yN)
```
```