Sha256: 5fcb06a158d693d5ccda786ed382e670187669211a80861f49eb0ebd19481f8f
Contents?: true
Size: 1020 Bytes
Versions: 8
Compression:
Stored size: 1020 Bytes
Contents
module Yao module Mode # @param blk [Proc] # @return [String] def read_only!(&blk) raise unless block_given? raise_on_write_org = Yao.config.raise_on_write noop_on_write_org = Yao.config.noop_on_write Yao.config.set :noop_on_write, false if noop_on_write_org Yao.config.set :raise_on_write, true begin yield ensure Yao.config.set :raise_on_write, raise_on_write_org Yao.config.set :noop_on_write, noop_on_write_org end end # @param blk [Proc] # @return [String] def read_only(&blk) raise unless block_given? noop_on_write_org = Yao.config.noop_on_write raise_on_write_org = Yao.config.raise_on_write Yao.config.set :raise_on_write, false if raise_on_write_org Yao.config.set :noop_on_write, true begin yield ensure Yao.config.set :noop_on_write, noop_on_write_org Yao.config.set :raise_on_write, raise_on_write_org end end end end
Version data entries
8 entries across 8 versions & 1 rubygems