Class: Cl::Runner::Default

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Merge
Defined in:
lib/cl/runner/default.rb

Constant Summary

Constants included from Merge

Merge::MERGE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Merge

#merge

Constructor Details

#initialize(ctx, args) ⇒ Default

Returns a new instance of Default.


17
18
19
20
# File 'lib/cl/runner/default.rb', line 17

def initialize(ctx, args)
  @ctx = ctx
  @const, @args = lookup(args)
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args


15
16
17
# File 'lib/cl/runner/default.rb', line 15

def args
  @args
end

#constObject (readonly)

Returns the value of attribute const


15
16
17
# File 'lib/cl/runner/default.rb', line 15

def const
  @const
end

#ctxObject (readonly)

Returns the value of attribute ctx


15
16
17
# File 'lib/cl/runner/default.rb', line 15

def ctx
  @ctx
end

#optsObject (readonly)

Returns the value of attribute opts


15
16
17
# File 'lib/cl/runner/default.rb', line 15

def opts
  @opts
end

Instance Method Details

#cmdObject


26
27
28
# File 'lib/cl/runner/default.rb', line 26

def cmd
  @cmd ||= const.new(ctx, args)
end

#helpObject


30
31
32
# File 'lib/cl/runner/default.rb', line 30

def help
  Help.new(ctx, [cmd.registry_key])
end

#runObject


22
23
24
# File 'lib/cl/runner/default.rb', line 22

def run
  cmd.help? ? help.run : cmd.run
end