= dm-ambition DataMapper::Ambition is a plugin that provides an Ambition-like API for accessing DataMapper models. == Installation With Rubygems: $ gem install dm-ambition $ irb -rubygems >> require 'dm-ambition' => true With git and local working copy: $ git clone git://github.com/dkubb/dm-ambition.git $ cd dm-ambition $ rake install $ irb -rubygems >> require 'dm-ambition' => true == Testing The simplest way to test is with Bundler since it handles all dependencies: $ rake local_gemfile $ BUNDLE_GEMFILE="Gemfile.local" ADAPTER="in_memory" bundle install --without=quality --relock $ BUNDLE_GEMFILE="Gemfile.local" ADAPTER="in_memory" bundle exec rake spec == Examples # with == operator User.select { |u| u.name == 'Dan Kubb' } # with =~ operator User.select { |u| u.name =~ /Dan Kubb/ } # with > operator User.select { |u| u.id > 1 } # with >= operator User.select { |u| u.id >= 1 } # with < operator User.select { |u| u.id < 1 } # with <= operator User.select { |u| u.id <= 1 } # with < operator User.select { |u| u.id < 1 } # with receiver.attribute.nil? User.select { |u| u.id.nil? } # with nil bind value User.select { |u| u.id == nil } # with true bind value User.select { |u| u.admin == true } # with false bind value User.select { |u| u.admin == false } # with AND conditions User.select { |u| u.id == 1 && u.name == 'Dan Kubb' } # with negated conditions User.select { |u| !(u.id == 1) } # with double-negated conditions User.select { |u| !(!(u.id == 1)) } # with matching from receiver User.select { |u| u == user } # with matching to receiver User.select { |u| user == u } # using send on receiver User.select { |u| u.send(:name) == 'Dan Kubb' } # with Array#include? User.select { |u| user_ids.include?(u.id) } # with Range#include? User.select { |u| (1..10).include?(u.id) } # with Hash#key? User.select { |u| { 1 => 'Dan Kubb' }.key?(u.id) } # with Hash#value? User.select { |u| { 'Dan Kubb' => 1 }.value?(u.id) } # with receiver and Array#include? User.select { |u| users.include?(u) } # with receiver and Hash#key? User.select { |u| { user => 'Dan Kubb' }.key?(u) } # with receiver and Hash#value? User.select { |u| { 'Dan Kubb' => user }.value?(u) } == License Copyright (c) 2011 Dan Kubb Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.