aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/algebra/extensions/hash.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel/algebra/extensions/hash.rb')
-rw-r--r--lib/arel/algebra/extensions/hash.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/arel/algebra/extensions/hash.rb b/lib/arel/algebra/extensions/hash.rb
new file mode 100644
index 0000000000..05c15e7ebe
--- /dev/null
+++ b/lib/arel/algebra/extensions/hash.rb
@@ -0,0 +1,11 @@
+module Arel
+ module HashExtensions
+ def bind(relation)
+ inject({}) do |bound, (key, value)|
+ bound.merge(key.bind(relation) => value.bind(relation))
+ end
+ end
+
+ Hash.send(:include, self)
+ end
+end