mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
reduce method calls in the dynamic finder matcher
This commit is contained in:
@@ -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 @@ module ActiveRecord
|
||||
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?
|
||||
|
||||
Reference in New Issue
Block a user