Skip to content

Instantly share code, notes, and snippets.

@JamesKyburz
Created August 9, 2011 11:31
Show Gist options
  • Save JamesKyburz/1133809 to your computer and use it in GitHub Desktop.
Save JamesKyburz/1133809 to your computer and use it in GitHub Desktop.
Allow sending extra parameters when using #symbol.to_proc
class Symbol
def [](*args)
proc {|obj|
obj.send(self,*args)
}
end
end
__END__
use case
[1,2,3,4].map(&:+[2]) # => [3, 4, 5, 6]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment