aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/symbol.rb
diff options
context:
space:
mode:
authorMarcel Molina <marcel@vernix.org>2005-11-21 02:15:32 +0000
committerMarcel Molina <marcel@vernix.org>2005-11-21 02:15:32 +0000
commit69bf71f5e9b537f88acc0d4492a057336e7305d1 (patch)
tree95ee3d561095960cecb519bb0060fd4067971f28 /activesupport/lib/active_support/core_ext/symbol.rb
parente9b26c52a28203a6c42d5edd1677555de1b05d15 (diff)
downloadrails-69bf71f5e9b537f88acc0d4492a057336e7305d1.tar.gz
rails-69bf71f5e9b537f88acc0d4492a057336e7305d1.tar.bz2
rails-69bf71f5e9b537f88acc0d4492a057336e7305d1.zip
Add Symbol#to_proc, which allows for, e.g. [:foo, :bar].map(&:to_s).
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3118 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/core_ext/symbol.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/symbol.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/symbol.rb b/activesupport/lib/active_support/core_ext/symbol.rb
new file mode 100644
index 0000000000..cd928aae80
--- /dev/null
+++ b/activesupport/lib/active_support/core_ext/symbol.rb
@@ -0,0 +1,5 @@
+class Symbol #:nodoc:
+ def to_proc
+ Proc.new { |obj, *args| obj.send(self, *args) }
+ end
+end