Module: Ing::Boot
- Included in:
- Commands::Generate, Commands::Implicit
- Defined in:
- lib/ing/commands/boot.rb
Overview
Base implementation of boot dispatch Mixed in to Commands::Implicit, Commands::Generate Note this does NOT provide any options, only provides implementation. Assumes target class will provide namespace
option, otherwise defaults to global namespace (::Object).
Instance Method Summary collapse
-
#after ⇒ Object
After hook, override in target class.
-
#before(*args) ⇒ Object
Before hook passed unprocessed args, override in target class.
-
#call(*args) ⇒ Object
- Main processing of arguments and dispatch from command line (
Ing.run
) Note that three hooks are provided for target classes,before
- runs before any processing of arguments or dispatch of command
configure_command
- configures the command prior to dispatch
after
-
runs after command dispatched.
- configures the command prior to dispatch
- runs before any processing of arguments or dispatch of command
- Main processing of arguments and dispatch from command line (
-
#configure_command(cmd) ⇒ Object
Configure the command prior to dispatch.
Instance Method Details
#after ⇒ Object
After hook, override in target class
16 17 |
# File 'lib/ing/commands/boot.rb', line 16 def after end |
#before(*args) ⇒ Object
Before hook passed unprocessed args, override in target class
12 13 |
# File 'lib/ing/commands/boot.rb', line 12 def before(*args) end |
#call(*args) ⇒ Object
Main processing of arguments and dispatch from command line (Ing.run
) Note that three hooks are provided for target classes,
+before+:: runs before any processing of arguments or dispatch of command
+configure_command+:: configures the command prior to dispatch
+after+:: runs after command dispatched
33 34 35 36 37 38 39 40 |
# File 'lib/ing/commands/boot.rb', line 33 def call(*args) before *args klass = _extract_class!(args) Ing.execute(klass, *args) do |cmd| configure_command cmd end after end |
#configure_command(cmd) ⇒ Object
Configure the command prior to dispatch. Default behavior is to set the shell of the dispatched command. Override in target class as needed; if you want to keep the default behavior then call super
.
23 24 25 |
# File 'lib/ing/commands/boot.rb', line 23 def configure_command(cmd) cmd.shell = Ing.shell_class.new if cmd.respond_to?(:"shell=") end |