Class: Cl::Ctx

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/cl/ctx.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, opts = {}) ⇒ Ctx

Returns a new instance of Ctx.



14
15
16
17
18
# File 'lib/cl/ctx.rb', line 14

def initialize(name, opts = {})
  @config = Config.new(name).to_h
  @ui = opts[:ui] || Ui.new(self, opts)
  @name = name
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



12
13
14
# File 'lib/cl/ctx.rb', line 12

def config
  @config
end

#nameObject

Returns the value of attribute name.



12
13
14
# File 'lib/cl/ctx.rb', line 12

def name
  @name
end

#uiObject

Returns the value of attribute ui.



12
13
14
# File 'lib/cl/ctx.rb', line 12

def ui
  @ui
end

Instance Method Details

#abort(error, *strs) ⇒ Object



20
21
22
# File 'lib/cl/ctx.rb', line 20

def abort(error, *strs)
  ui.abort(error, *strs)
end

#test?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/cl/ctx.rb', line 24

def test?
  ENV['ENV'] == 'test'
end