Permalink
Browse files

removing parameter requirement for matching_attributes

  • Loading branch information...
1 parent 06cc73c commit c7b4f12d9339504b58431de0145d9a965008e650 @tenderlove committed Aug 6, 2010
Showing with 9 additions and 14 deletions.
  1. +0 −14 lib/arel/algebra/relations/relation.rb
  2. +9 −0 lib/arel/engines/sql/relations/table.rb
@@ -197,19 +197,5 @@ def taken; nil end
def skipped; nil end
def sources; [] end
def locked; [] end
-
- private
- def matching_attributes(attribute)
- unless @matching_attributes
- @matching_attributes = Hash[attributes.map do |a|
- [a.root, a]
- end]
- end
- [@matching_attributes[attribute.root]] || []
- end
-
- def has_attribute?(attribute)
- !matching_attributes(attribute).empty?
- end
end
end
@@ -82,6 +82,15 @@ def reset
@columns = nil
@attributes = Header.new([])
end
+
+ private
+ def matching_attributes
+ @matching_attributes ||= Hash[attributes.map { |a| [a.root, true] }]
+ end
+
+ def has_attribute?(attribute)
+ matching_attributes.key? attribute.root
+ end
end
end

0 comments on commit c7b4f12

Please sign in to comment.