aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/algebra/relations/relation.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel/algebra/relations/relation.rb')
-rw-r--r--lib/arel/algebra/relations/relation.rb14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/arel/algebra/relations/relation.rb b/lib/arel/algebra/relations/relation.rb
index e8ef9b395d..dd0684b88e 100644
--- a/lib/arel/algebra/relations/relation.rb
+++ b/lib/arel/algebra/relations/relation.rb
@@ -116,19 +116,17 @@ module Arel
end
%w{
- where order skip group having
- }.each do |operation_name|
+ having group order where project
+ }.each do |op|
class_eval <<-OPERATION, __FILE__, __LINE__
- def #{operation_name}(*arguments)
- arguments.all? { |x| x.blank? } ?
- self : #{operation_name.capitalize}.new(self, *arguments)
+ def #{op}(*args)
+ args.all? { |x| x.blank? } ? self : #{op.capitalize}.new(self, args)
end
OPERATION
end
- def project *args
- return self if args.all? { |x| x.blank? }
- Project.new self, *args
+ def skip thing = nil
+ thing ? Skip.new(self, thing) : self
end
def take thing