[ANN] polyglot 0.1.0 Released

C

Clifford Heath

Polyglot version 0.1.0 has been released!

* <http://polyglot.rubyforge.org>

Allows custom language loaders for specified file extensions to be hooked into require.

For anyone who's ever needed to load non-Ruby file types, especially to implement
a fully-custom DSL (as opposed to a Ruby DSL), this gem allows you to simply require
the file-type handler, then require your file.

The file-type handler is a loader for files identified by your special filename extension.
It registers itself with polyglot, which aliases Kernel.require.

When you then require "myfile", polyglot will first attempt a normal Ruby 'require', and
if that fails, will search the Ruby load path for a filename matching any of the registered
extensions, and call the loader for that extension.

As an example, I'm building a query language called CQL. *.cql files can be loaded by a
parser which creates Ruby classes. All I have to do is:

require "cql"
require "myqueries"

and the CQL loader will load "myqueries.cql".

You might need to wait a few hours for the gem to populate into the mirrors.

Clifford Heath.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,796
Messages
2,569,645
Members
45,362
Latest member
OrderTrimKetoBoost

Latest Threads

Top