A Javascript (function) interpreter for Ruby.
Doily was basically designed to support CouchDB views. So, you can do stuff like this:
class CouchDBView def map(function, documents) function = Doily(function).delegate(self) @results = [] documents.each { |doc| function.call(doc) } @results end def emit(key, value) @results.push(:key => key, :value => value) end end map_function = <<-END function(doc) { if (doc.chef_type == 'node') { emit(doc.name, doc); } } END CouchDBView.new.map(map_function, Document.all)
gem sources --add http://gems.github.com gem install matthewtodd-doily
Or, if you want to run tests & features:
gem sources --add http://gems.github.com gem sources --add http://gems.opscode.com gem install matthewtodd-doily --development
-
github.com/jbarnette/johnson - Ruby wrapper for SpiderMonkey
-
github.com/jcoglan/siren - JSON parser / query language
-
others?