Skip to content

Commit

Permalink
unfactoring DefaultOperations
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Aug 4, 2010
1 parent 1b4e771 commit 0bb00a6
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions lib/arel/algebra/relations/relation.rb
Expand Up @@ -194,6 +194,19 @@ def position_of(attribute)
@position_of[attribute] = attributes.index(attributes[attribute]) @position_of[attribute] = attributes.index(attributes[attribute])
end end


def attributes; Header.new end
def projections; [] end
def wheres; [] end
def orders; [] end
def inserts; [] end
def groupings; [] end
def havings; [] end
def joins(formatter = nil); nil end # FIXME
def taken; nil end
def skipped; nil end
def sources; [] end
def locked; [] end

private private
def matching_attributes(attribute) def matching_attributes(attribute)
(@matching_attributes ||= attributes.inject({}) do |hash, a| (@matching_attributes ||= attributes.inject({}) do |hash, a|
Expand All @@ -205,21 +218,5 @@ def matching_attributes(attribute)
def has_attribute?(attribute) def has_attribute?(attribute)
!matching_attributes(attribute).empty? !matching_attributes(attribute).empty?
end end

module DefaultOperations
def attributes; Header.new end
def projections; [] end
def wheres; [] end
def orders; [] end
def inserts; [] end
def groupings; [] end
def havings; [] end
def joins(formatter = nil); nil end # FIXME
def taken; nil end
def skipped; nil end
def sources; [] end
def locked; [] end
end
include DefaultOperations
end end
end end

0 comments on commit 0bb00a6

Please sign in to comment.