Class: Cl::Runner::Default
- Inherits:
-
Object
- Object
- Cl::Runner::Default
- Extended by:
- Forwardable
- Includes:
- Merge
- Defined in:
- lib/cl/runner/default.rb
Constant Summary
Constants included from Merge
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#const ⇒ Object
readonly
Returns the value of attribute const.
-
#ctx ⇒ Object
readonly
Returns the value of attribute ctx.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
Instance Method Summary collapse
- #cmd ⇒ Object
- #help ⇒ Object
-
#initialize(ctx, args) ⇒ Default
constructor
A new instance of Default.
- #run ⇒ Object
Methods included from 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
#args ⇒ Object (readonly)
Returns the value of attribute args.
15 16 17 |
# File 'lib/cl/runner/default.rb', line 15 def args @args end |
#const ⇒ Object (readonly)
Returns the value of attribute const.
15 16 17 |
# File 'lib/cl/runner/default.rb', line 15 def const @const end |
#ctx ⇒ Object (readonly)
Returns the value of attribute ctx.
15 16 17 |
# File 'lib/cl/runner/default.rb', line 15 def ctx @ctx end |
#opts ⇒ Object (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
#cmd ⇒ Object
26 27 28 |
# File 'lib/cl/runner/default.rb', line 26 def cmd @cmd ||= const.new(ctx, args) end |
#help ⇒ Object
30 31 32 |
# File 'lib/cl/runner/default.rb', line 30 def help Help.new(ctx, [cmd.registry_key]) end |
#run ⇒ Object
22 23 24 |
# File 'lib/cl/runner/default.rb', line 22 def run cmd.help? ? help.run : cmd.run end |