aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/math.rb
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2016-01-06 14:22:11 -0200
committerRafael França <rafaelmfranca@gmail.com>2016-01-06 14:22:11 -0200
commitb0338475babfb8388691c8f6b0af674707a6a70e (patch)
treede75f21653caf477e4059db9ea50a1c12ec391a7 /lib/arel/math.rb
parentffc4b8e93af4356110c7a2573cc3340145baa02b (diff)
parentc22abda79b7f0fbee5f0ef0e9648d52d7d483902 (diff)
downloadrails-b0338475babfb8388691c8f6b0af674707a6a70e.tar.gz
rails-b0338475babfb8388691c8f6b0af674707a6a70e.tar.bz2
rails-b0338475babfb8388691c8f6b0af674707a6a70e.zip
Merge pull request #408 from sjaveed/bitwise_operations
Support for Bitwise Operations as InfixOperations
Diffstat (limited to 'lib/arel/math.rb')
-rw-r--r--lib/arel/math.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/arel/math.rb b/lib/arel/math.rb
index f3dbc7bc49..04cae84598 100644
--- a/lib/arel/math.rb
+++ b/lib/arel/math.rb
@@ -15,5 +15,29 @@ module Arel
def /(other)
Arel::Nodes::Division.new(self, other)
end
+
+ def &(other)
+ Arel::Nodes::Grouping.new(Arel::Nodes::BitwiseAnd.new(self, other))
+ end
+
+ def |(other)
+ Arel::Nodes::Grouping.new(Arel::Nodes::BitwiseOr.new(self, other))
+ end
+
+ def ^(other)
+ Arel::Nodes::Grouping.new(Arel::Nodes::BitwiseXor.new(self, other))
+ end
+
+ def <<(other)
+ Arel::Nodes::Grouping.new(Arel::Nodes::BitwiseShiftLeft.new(self, other))
+ end
+
+ def >>(other)
+ Arel::Nodes::Grouping.new(Arel::Nodes::BitwiseShiftRight.new(self, other))
+ end
+
+ def ~@
+ Arel::Nodes::BitwiseNot.new(self)
+ end
end
end