aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/math.rb
diff options
context:
space:
mode:
authorVladimir Meremyanin <vladimir@meremyanin.com>2011-01-29 14:40:39 +0800
committerVladimir Meremyanin <vladimir@meremyanin.com>2011-01-29 14:40:39 +0800
commit2158d592c074813471baa8fa20044b683bb156e6 (patch)
treee124804a463c55547dd9fe7c4b80e96ce5690065 /lib/arel/math.rb
parent7b445c6dd578277f7313746fc497429a56e4b43c (diff)
downloadrails-2158d592c074813471baa8fa20044b683bb156e6.tar.gz
rails-2158d592c074813471baa8fa20044b683bb156e6.tar.bz2
rails-2158d592c074813471baa8fa20044b683bb156e6.zip
implemented support for math operations in numeric attributes
Diffstat (limited to 'lib/arel/math.rb')
-rw-r--r--lib/arel/math.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/arel/math.rb b/lib/arel/math.rb
new file mode 100644
index 0000000000..551b1f1010
--- /dev/null
+++ b/lib/arel/math.rb
@@ -0,0 +1,21 @@
+module Arel
+ module Math
+
+ def *(other)
+ Arel::Nodes::Multiplication.new(self, other)
+ end
+
+ def +(other)
+ Arel::Nodes::Addition.new(self, other)
+ end
+
+ def -(other)
+ Arel::Nodes::Subtraction.new(self, other)
+ end
+
+ def /(other)
+ Arel::Nodes::Division.new(self, other)
+ end
+
+ end
+end \ No newline at end of file