Last active
December 30, 2015 22:38
-
-
Save dlisboa/7895174 to your computer and use it in GitHub Desktop.
This file contains 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
File.open("foo", "w+") {|f| f.puts "bar"} | |
File.open("foo", "w+") {|f| f.read } #=> queria "bar", mas retorna "" | |
# API que eu quero | |
resolver.with_file do |file| | |
file.write 'bar' | |
end # => 3 | |
resolver.with_file do |file| | |
file.read | |
end # => "bar" | |
#--- | |
resolver.with_file do |_, file| | |
file.write 'bar' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment