2011-03-08 13:27:43 -05:00
|
|
|
module Arel
|
|
|
|
module Nodes
|
|
|
|
|
|
|
|
class InfixOperation < Binary
|
|
|
|
include Arel::Expressions
|
|
|
|
include Arel::Predications
|
2011-04-29 15:08:27 -04:00
|
|
|
include Arel::OrderPredications
|
2011-04-29 13:36:22 -04:00
|
|
|
include Arel::AliasPredication
|
2011-03-08 13:27:43 -05:00
|
|
|
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
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|