Skip to content

Commit

Permalink
Removing reek smells in doc
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Sep 24, 2009
1 parent b4e57c5 commit 405abfb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/mongoid/document.rb
Expand Up @@ -52,10 +52,11 @@ def fields(*names)
# Model.find(:first, :attribute => "value")
# Model.find(:all, :attribute => "value")
def find(*args)
case args[0]
when :all then find_all(args[1])
when :first then find_first(args[1])
else find_first(Mongo::ObjectID.from_string(args[0].to_s))
type, selector = args[0], args[1]
case type
when :all then find_all(selector)
when :first then find_first(selector)
else find_first(Mongo::ObjectID.from_string(type.to_s))
end
end

Expand Down

0 comments on commit 405abfb

Please sign in to comment.