diff options
author | Shahbaz Javeed <sjaveed@gmail.com> | 2015-12-10 16:50:28 -0500 |
---|---|---|
committer | Shahbaz Javeed <sjaveed@gmail.com> | 2016-01-06 11:18:42 -0500 |
commit | c22abda79b7f0fbee5f0ef0e9648d52d7d483902 (patch) | |
tree | de75f21653caf477e4059db9ea50a1c12ec391a7 /lib/arel/visitors | |
parent | ffc4b8e93af4356110c7a2573cc3340145baa02b (diff) | |
download | rails-c22abda79b7f0fbee5f0ef0e9648d52d7d483902.tar.gz rails-c22abda79b7f0fbee5f0ef0e9648d52d7d483902.tar.bz2 rails-c22abda79b7f0fbee5f0ef0e9648d52d7d483902.zip |
* Support for bitwise operations as infix operators. Tests included.
*** Individual commit messages included below ***
* Preliminary support for bitwise operations as infix operators. Tests to follow.
* Added bitwise xor, shift left and shift right operators
* Fixed the BitwiseOr class so it uses the :| operator instead of :&
* All the methods for the bitwise operators in the Arel::Math module now wrap them up in Arel::Nodes::Grouping so the operation becomes isolated like addition and subtraction
* Preliminary set of tests for the new operators
* Updated README with examples of bitwise operations
* Added a new UnaryOperation class which is a riff on the InfixOperation class
* Added tests for UnaryOperation (inspired by InfixOperation tests)
* Added the bitwise not (~) operator as a UnaryOperation
* Added tests for the bitwise not operator
* Added documentation for the bitwise not operator
* Updated gemspec using `rake arel.gemspec`
Diffstat (limited to 'lib/arel/visitors')
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index 598bf2d984..80bea56ce6 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -801,6 +801,11 @@ module Arel alias :visit_Arel_Nodes_Multiplication :visit_Arel_Nodes_InfixOperation alias :visit_Arel_Nodes_Division :visit_Arel_Nodes_InfixOperation + def visit_Arel_Nodes_UnaryOperation o, collector + collector << " #{o.operator} " + visit o.expr, collector + end + def visit_Array o, collector inject_join o, collector, ", " end |