Skip to content
Browse files

reduce method calls in the dynamic finder matcher

  • Loading branch information...
1 parent 40bc0cb commit 10d9740827df707b56ef246da5bff8d1523ddf5f @tenderlove tenderlove committed
Showing with 4 additions and 4 deletions.
  1. +4 −4 activerecord/lib/active_record/dynamic_finder_match.rb
View
8 activerecord/lib/active_record/dynamic_finder_match.rb
@@ -6,8 +6,8 @@ module ActiveRecord
#
class DynamicFinderMatch
def self.match(method)
- df_match = self.new(method)
- df_match.finder ? df_match : nil
+ df_match = new(method)
+ df_match.finder && df_match
end
def initialize(method)
@@ -35,11 +35,11 @@ def initialize(method)
attr_reader :finder, :attribute_names, :instantiator
def finder?
- !@finder.nil? && @instantiator.nil?
+ @finder && !@instantiator
end
def instantiator?
- @finder == :first && !@instantiator.nil?
+ @finder == :first && @instantiator
end
def creator?

0 comments on commit 10d9740

Please sign in to comment.
Something went wrong with that request. Please try again.