Skip to content

Commit

Permalink
super-sexy Array#to_proc
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay Adkisson committed Jul 1, 2010
1 parent 5118c06 commit 13a3d8f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/array.rb
@@ -0,0 +1,11 @@
class Array
def to_proc
proc do |*args|
target = args.shift
self.map do |e|
target = e.to_proc.call(target)
end
target
end
end
end

0 comments on commit 13a3d8f

Please sign in to comment.