class Coque::Context

Attributes

dir[R]
env[R]

Public Class Methods

new(dir = Dir.pwd, env = {}, disinherits_env = false) click to toggle source
# File lib/coque/context.rb, line 4
def initialize(dir = Dir.pwd, env = {}, disinherits_env = false)
  @dir = dir
  @env = env
  @disinherits_env = disinherits_env
end

Public Instance Methods

[](*args) click to toggle source
# File lib/coque/context.rb, line 14
def [](*args)
  Sh.new(self, args)
end
chdir(new_dir) click to toggle source
# File lib/coque/context.rb, line 22
def chdir(new_dir)
  Context.new(new_dir, env, disinherits_env?)
end
disinherit_env() click to toggle source
# File lib/coque/context.rb, line 31
def disinherit_env
  Context.new(dir, {}, true)
end
disinherits_env?() click to toggle source
# File lib/coque/context.rb, line 10
def disinherits_env?
  @disinherits_env
end
rb(&block) click to toggle source
# File lib/coque/context.rb, line 18
def rb(&block)
  Rb.new(self, &block)
end
setenv(opts) click to toggle source
# File lib/coque/context.rb, line 26
def setenv(opts)
  opts = opts.map { |k,v| [k.to_s, v.to_s] }.to_h
  Context.new(dir, self.env.merge(opts), disinherits_env?)
end