Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Fancy wrapper for Ripple, Ruby's rich modeling layer for Riak.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 tests
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 ripple.fy.fancypack
README.md

Ripple.fy

A Fancy wrapper for Ripple, Ruby's rich modeling layer for Riak.

This package exposes Ripple (https://github.com/seancribbs/ripple) to Fancy in an idiomatic way. You can easily define Model properties and relationships that are backed by and stored in Riak, the distributed key-value database.

Example usage:

class Person # forward declaration due to reference in Pet class below

class Pet {
  include: Ripple Model
  properties: {
    name: { type: String }
  }
  key: 'name
  has_one: 'person type: Person
}

class Person {
  include: Ripple Model
  properties: {
    name: { type: String }
    age: { type: Fixnum }
  }
  key: 'name
  has_many: 'pets type: Pet
}

# Let's create a Person (create automatically saves it to Riak after creation):
tom = Person create: @{
  name: "Tom Tucker"
  age: 55
}

kitty = Pet create: @{
  name: "Kitty Cat"
  person: tom
}

tom save: @{ pets << kitty } # add kitty to tom's pets and save tom

# Find Tom by his key:

tom = Person find: "Tom Tucker" # as defined above, the key for a Person is its name
# find: returns nil if the given key is invalid.
# alternatively use find!: which raises an Exception if given an invalid key:
tom = Person find!: "Tom Tucker"

Copyright

(C) 2012 Christopher Bertels chris@fancy-lang.org

Released under the same license as Ripple: Apache License, Version 2.0

For more information see:

Something went wrong with that request. Please try again.