Sha256: 8efb2b0efa932d5ad2ad317ff0287934e5ab78015b5d31fb19708a8e1b6be6da
Contents?: true
Size: 857 Bytes
Versions: 3
Compression:
Stored size: 857 Bytes
Contents
# Copyright 2017 Kouhei Sutou <kou@clear-code.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. module Arrow module BlockOpenable def open(*args, &block) io = super(*args) return io unless block return yield(io) unless io.respond_to?(:close) begin yield(io) ensure io.close end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
red-arrow-0.2.2 | lib/arrow/block-openable.rb |
red-arrow-0.2.1 | lib/arrow/block-openable.rb |
red-arrow-0.2.0 | lib/arrow/block-openable.rb |