diff options
author | Matthew Draper <matthew@trebex.net> | 2018-04-25 08:18:02 +0930 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-25 08:18:02 +0930 |
commit | 989b1cb4a326632a686d61df42695b27e4ef6b2e (patch) | |
tree | 026a41714b44dba185f084f8f21bb81eb01db681 /activerecord/lib/arel/nodes/infix_operation.rb | |
parent | 7e815415edbe42f1df64d786a8f923a171778d64 (diff) | |
parent | 354f1c28e81d9846fb9e5346fcca50cf303c12c1 (diff) | |
download | rails-989b1cb4a326632a686d61df42695b27e4ef6b2e.tar.gz rails-989b1cb4a326632a686d61df42695b27e4ef6b2e.tar.bz2 rails-989b1cb4a326632a686d61df42695b27e4ef6b2e.zip |
Merge pull request #32097 from matthewd/arel
Merge Arel
Diffstat (limited to 'activerecord/lib/arel/nodes/infix_operation.rb')
-rw-r--r-- | activerecord/lib/arel/nodes/infix_operation.rb | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/activerecord/lib/arel/nodes/infix_operation.rb b/activerecord/lib/arel/nodes/infix_operation.rb new file mode 100644 index 0000000000..bc7e20dcc6 --- /dev/null +++ b/activerecord/lib/arel/nodes/infix_operation.rb @@ -0,0 +1,80 @@ +# frozen_string_literal: true + +module Arel # :nodoc: all + module Nodes + class InfixOperation < Binary + include Arel::Expressions + include Arel::Predications + include Arel::OrderPredications + include Arel::AliasPredication + include Arel::Math + + attr_reader :operator + + def initialize(operator, left, right) + super(left, right) + @operator = operator + end + end + + class Multiplication < InfixOperation + def initialize(left, right) + super(:*, left, right) + end + end + + class Division < InfixOperation + def initialize(left, right) + super(:/, left, right) + end + end + + class Addition < InfixOperation + def initialize(left, right) + super(:+, left, right) + end + end + + class Subtraction < InfixOperation + def initialize(left, right) + super(:-, left, right) + end + end + + class Concat < InfixOperation + def initialize(left, right) + super("||", left, right) + end + end + + class BitwiseAnd < InfixOperation + def initialize(left, right) + super(:&, left, right) + end + end + + class BitwiseOr < InfixOperation + def initialize(left, right) + super(:|, left, right) + end + end + + class BitwiseXor < InfixOperation + def initialize(left, right) + super(:^, left, right) + end + end + + class BitwiseShiftLeft < InfixOperation + def initialize(left, right) + super(:<<, left, right) + end + end + + class BitwiseShiftRight < InfixOperation + def initialize(left, right) + super(:>>, left, right) + end + end + end +end |