Created
August 12, 2009 08:23
-
-
Save moro/166394 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.class_eval do | |
def to_proc | |
first, *rest = self | |
Proc.new{|o| o.send(first, *rest) } | |
end | |
end | |
# p (1..10).map{|i|i.divmod(2)} | |
p (1..10).map(&[:divmod,2]) | |
content = "Hello World" | |
File.open("/tmp/foobar.txt", "w", &[:puts, content]) | |
puts File.read("/tmp/foobar.txt") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment