From e199b33aaaa740f9eeba07340e3cade316cfac78 Mon Sep 17 00:00:00 2001 From: John Nunemaker Date: Sat, 28 May 2011 12:45:30 -0400 Subject: [PATCH] Added array of methods that perform queries. --- lib/plucky.rb | 11 +++++++++++ test/test_plucky.rb | 14 ++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/lib/plucky.rb b/lib/plucky.rb index a9b5574..e67adf5 100644 --- a/lib/plucky.rb +++ b/lib/plucky.rb @@ -14,6 +14,17 @@ module Pagination autoload :Paginator, 'plucky/pagination/paginator' end + # Array of methods that actually perform queries + Methods = [ + :where, :filter, :limit, :skip, :offset, :sort, :order, + :fields, :ignore, :only, + :each, :find_each, + :count, :size, :distinct, + :last, :first, :all, :paginate, + :exists?, :exist?, :empty?, + :to_a, :remove, + ] + def self.to_object_id(value) return value if value.is_a?(BSON::ObjectId) return nil if value.nil? || (value.respond_to?(:empty?) && value.empty?) diff --git a/test/test_plucky.rb b/test/test_plucky.rb index 848ab14..559644e 100644 --- a/test/test_plucky.rb +++ b/test/test_plucky.rb @@ -28,5 +28,19 @@ class PluckyTest < Test::Unit::TestCase Plucky.to_object_id(1).should == 1 end end + + context "::Methods" do + should "return array of methods" do + Plucky::Methods.should == [ + :where, :filter, :limit, :skip, :offset, :sort, :order, + :fields, :ignore, :only, + :each, :find_each, + :count, :size, :distinct, + :last, :first, :all, :paginate, + :exists?, :exist?, :empty?, + :to_a, :remove, + ] + end + end end end \ No newline at end of file