Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

chill plugs ruby code in to CouchDB

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 lib
Octocat-spinner-32 website
Octocat-spinner-32 .gitignore
Octocat-spinner-32 changelog.txt
Octocat-spinner-32 chill.gemspec
Octocat-spinner-32 license.txt
Octocat-spinner-32 readme.txt
readme.txt
.oOo. .oOo. .oOo. chill .oOo. .oOo. .oOo.

chill plugs ruby code in to CouchDB


~~~ USAGE ~~~
require 'pp'
require 'chill'

# make a database or connect to one
ChillDB.goes :KittensApp

# add a template (just in ruby instance)
KittensApp.templates(
  cat: {
    color: 'invisible',
    softness: 5,
    likes: %w{water food flying spaceships sunlight tictacs hugs exploding},
    dislikes: %w{mysql}
  }
)

# get a copy of a template, change some things, and save it
KittensApp.template(:cat).merge(
  color: 'green',
  softness: 8,
  dislikes: %w{stylesheets},
  _id: 'fredrick'
)

# add a view
KittensApp.design(:lists).views(
  soft_cats: 'function(doc) {
    if (doc.kind == "cat" && doc.softness > 1) emit(doc._id, null);
  }'
).commit!

# add a kitten
KittensApp.template(:cat).merge(
  _id: 'fredrick',
  softness: 16,
  dislikes: ['silly business']
).commit!

# use the view to get a list of non-hard cats
soft_ones = KittensApp.design(:lists).query(:soft_cats)
soft_ones.each do |cat|
  pp cat
end

# just load fredrick
fredrick = KittensApp['fredrick']


~~~ MORE INFORMATION THAN YOU REQUIRE ~~~
You can see a more fully baked version of the KittensApp database in
examples/kittens-app.rb. There you will see how to do all sorts of things.
It's the start of a really great kitten database you could use to keep
track of your cats. It's web scale and cloud ready.

                                                          --- <3 Bluebie
Something went wrong with that request. Please try again.