class Cl::Ctx

Attributes

config[RW]
name[RW]
opts[RW]

Public Class Methods

new(name, opts = {}) click to toggle source
# File lib/cl/ctx.rb, line 14
def initialize(name, opts = {})
  @config = Config.new(name).to_h
  @opts = opts
  @name = name
end

Public Instance Methods

abort(error, *strs) click to toggle source
# File lib/cl/ctx.rb, line 24
def abort(error, *strs)
  abort? ? ui.abort(error, *strs) : raise(error)
end
abort?() click to toggle source
# File lib/cl/ctx.rb, line 28
def abort?
  !opts[:abort].is_a?(FalseClass)
end
test?() click to toggle source
# File lib/cl/ctx.rb, line 32
def test?
  ENV['ENV'] == 'test'
end
ui() click to toggle source
# File lib/cl/ctx.rb, line 20
def ui
  @ui ||= opts[:ui] || Ui.new(self, opts)
end