Skip to content

Commit

Permalink
Use Plucky::Methods to determine what methods to delegate to query [F…
Browse files Browse the repository at this point in the history
  • Loading branch information
brianhempel committed Apr 26, 2012
1 parent 2f746fb commit b965105
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 29 deletions.
Expand Up @@ -4,7 +4,8 @@ module Plugins
module Associations
class ManyDocumentsProxy < Collection
include DynamicQuerying::ClassMethods
include Querying::PluckyMethods

def_delegators :query, *(Querying::Methods - [:to_a, :size, :empty?])

def replace(docs)
load_target
Expand Down
8 changes: 1 addition & 7 deletions lib/mongo_mapper/plugins/querying.rb
@@ -1,6 +1,5 @@
# encoding: UTF-8
require 'mongo_mapper/plugins/querying/decorator'
require 'mongo_mapper/plugins/querying/plucky_methods'

module MongoMapper
module Plugins
Expand All @@ -9,13 +8,8 @@ module Querying

module ClassMethods
extend Forwardable
include PluckyMethods

def_delegators :query, :to_a, :size, :empty?

def find_each(opts={})
super(opts).each { |doc| yield(doc) }
end
def_delegators :query, *Querying::Methods

def find_by_id(id)
find_one(:_id => id)
Expand Down
2 changes: 2 additions & 0 deletions lib/mongo_mapper/plugins/querying/decorator.rb
Expand Up @@ -2,6 +2,8 @@
module MongoMapper
module Plugins
module Querying
Methods = Plucky::Methods + [:find!]

module Decorator
include DynamicQuerying::ClassMethods

Expand Down
21 changes: 0 additions & 21 deletions lib/mongo_mapper/plugins/querying/plucky_methods.rb

This file was deleted.

0 comments on commit b965105

Please sign in to comment.