class Slightish::Sandbox

Attributes

path[R]

Public Class Methods

new(template_dir: nil, prefix: 'slightish') click to toggle source
# File lib/slightish/sandbox.rb, line 7
def initialize(template_dir: nil, prefix: 'slightish')
  @path = Dir.mktmpdir(prefix)

  # The '.' prevents cp_r from making a new directory at the destination --
  # kind of the equivalent of '/*' in bash.
  FileUtils.cp_r(File.join(template_dir, '.'), @path) unless template_dir.nil?
end

Public Instance Methods

delete() click to toggle source
# File lib/slightish/sandbox.rb, line 15
def delete
  FileUtils.remove_entry_secure(@path)
end