This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.document | Sun Aug 30 08:16:58 -0700 2009 | |
| |
.gitignore | Sun Aug 30 08:16:58 -0700 2009 | |
| |
LICENSE | Sun Aug 30 08:16:58 -0700 2009 | |
| |
README.markdown | Wed Sep 16 07:45:42 -0700 2009 | |
| |
Rakefile | Wed Sep 16 06:06:35 -0700 2009 | |
| |
lib/ | Wed Sep 16 06:06:35 -0700 2009 | |
| |
spec/ | Wed Sep 16 06:06:35 -0700 2009 |
README.markdown
dm-sugar-glider
DISCLAIMER
This is ALPHA software, and is not yet complete. Currently block matching only works with properties on the model being queried. Relationship/Path targeting is pending. SugarGlider also requires
Abstract
SugarGlider is an end user query interface for DataMapper. It retains backwards-compatibility with DataMapper's existing query interface (condition hashes), and adds the capability to query using nested blocks, inspired by Thoughtbot's Squirrel library.
Description
Usage
The following are all equivalent queries:
Human.all(:last_name => "Obama", :first_name => /a/)
Human.all(:last_name => "Obama"){ first_name =~ /a/}
Human.all{ last_name == "Obama"; first_name =~ /a/}
Additionally SugarGlider adds functionality which is not exposed through the hash query interface namely, nested conditions, and logical ORs as well as logical ANDs:
Human.any{ first_name =~ /ar/; sex == "F" } # => Barack Obama + ALL women
Human.all{ first_name =~ /ar/; sex == "F" } # => Hillary Clinton, Barbra Bush, Barb Bush
Human.any{ last_name == "Obama"; all{ last_name == "Bush"; sex == "F"}} # => The Obama family, and all the Bush women.
Human.all{ sex == "F"; any{ last_name == "Clinton"; last_name == "Bush"}} # => Women from either the Bushes or Clintons
Copyright
Copyright (c) 2009 Ted Han. See LICENSE for details.







