Sha256: a77dcb327530901143c2f130abc9f61cf882d60cb1f41f257471ad1e840db29d
Contents?: true
Size: 760 Bytes
Versions: 6
Compression:
Stored size: 760 Bytes
Contents
module Wright # rubocop:disable Documentation @dry_run = false # Checks if dry-run mode is currently active. # # @example # puts 'Just a dry-run...' if Wright.dry_run? # # @return [Bool] true if dry-run mode is currently active and false # otherwise def self.dry_run? @dry_run end # Runs a block in dry-run mode. # # @example # Wright.dry_run do # symlink '/tmp/fstab' do |s| # s.to = '/etc/fstab' # end # end # # @return the block's return value def self.dry_run saved_dry_run = @dry_run @dry_run = true yield ensure @dry_run = saved_dry_run end # @api private # Activates dry-run mode. # @return [void] def self.activate_dry_run @dry_run = true end end
Version data entries
6 entries across 6 versions & 1 rubygems