Created
September 29, 2017 06:56
-
-
Save yancya/89235d578a1d19e8ca7a1f466ca18341 to your computer and use it in GitHub Desktop.
with_resources のサンプル
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
require 'with_resources/toplevel' | |
using WithResources::TopLevel | |
resources = -> () { | |
hello = StringIO.new('Hello') | |
world = StringIO.new('World') | |
} | |
with(resources) do |hello, world| | |
puts "#{hello.gets}, #{world.gets}" | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment