提交 635f11d7 编写于 作者: A Aaron Patterson

no need for a lambda

上级 e26006fb
......@@ -29,6 +29,8 @@ def == other
@ancestor == other.ancestor
end
alias :eql? :==
def named?(hypothetical_name)
(@alias || name).to_s == hypothetical_name.to_s
end
......@@ -41,8 +43,6 @@ def eval(row)
row[self]
end
alias :eql? :==
def hash
@hash ||= name.hash + root.relation.hash
end
......
......@@ -187,9 +187,11 @@ def find_attribute_matching_attribute(attribute)
end
def position_of(attribute)
(@position_of ||= Hash.new do |h, attribute|
h[attribute] = attributes.index(self[attribute])
end)[attribute]
@position_of ||= {}
return @position_of[attribute] if @position_of.key? attribute
@position_of[attribute] = attributes.index(attributes[attribute])
end
private
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册