diff options
Diffstat (limited to 'lib/arel/nodes')
-rw-r--r-- | lib/arel/nodes/infix_operation.rb | 42 | ||||
-rw-r--r-- | lib/arel/nodes/math_operation.rb | 15 |
2 files changed, 42 insertions, 15 deletions
diff --git a/lib/arel/nodes/infix_operation.rb b/lib/arel/nodes/infix_operation.rb new file mode 100644 index 0000000000..6847650fe4 --- /dev/null +++ b/lib/arel/nodes/infix_operation.rb @@ -0,0 +1,42 @@ +module Arel + module Nodes + + class InfixOperation < Binary + include Arel::Expressions + include Arel::Predications + 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
\ No newline at end of file diff --git a/lib/arel/nodes/math_operation.rb b/lib/arel/nodes/math_operation.rb deleted file mode 100644 index d9820f1ece..0000000000 --- a/lib/arel/nodes/math_operation.rb +++ /dev/null @@ -1,15 +0,0 @@ -module Arel - module Nodes - class MathOperation < Binary - include Arel::Expressions - include Arel::Predications - include Arel::Math - end - - class Multiplication < MathOperation; end - class Division < MathOperation; end - class Addition < MathOperation; end - class Subtraction < MathOperation; end - - end -end
\ No newline at end of file |