Skip to content
A Javascript (function) interpreter for Ruby.
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
features
lib
test
.gitignore
README.rdoc
Rakefile
TODO.rdoc
doily.gemspec

README.rdoc

Doily

A Javascript (function) interpreter for Ruby.

Examples

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)

Install

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

Alternatives (More or Less)

Something went wrong with that request. Please try again.