lib/facet/symbol/to_proc.rb in facets-0.7.2 vs lib/facet/symbol/to_proc.rb in facets-0.9.0
- old
+ new
@@ -1,22 +2 @@
-#--
-# Credit goes to Florian Gross (flgr).
-#++
-class Symbol
- # Turn a symbol into a proc calling the method to
- # which it refers.
- #
- # require 'facet/symbol/to_proc'
- #
- # up = :upcase.to_proc
- # up.call("hello") #=> HELLO
- #
- # More useful is the fact that this allows <tt>&</tt>
- # to be used to coerce Symbol into Proc.
- #
- # %w{foo bar qux}.map(&:upcase) #=> ["FOO","BAR","QUX"]
- # [1, 2, 3].inject(&:+) #=> 6
- #
- def to_proc
- proc { |obj, *args| obj.send(self, *args) }
- end
-end
+require 'nano/symbol/to_proc.rb'
\ No newline at end of file