Class: Brigadier::Commands::Command
- Inherits:
-
Object
- Object
- Brigadier::Commands::Command
- Includes:
- Base
- Defined in:
- lib/brigadier/commands/command.rb
Instance Attribute Summary collapse
-
#instance ⇒ Object
readonly
Returns the value of attribute instance.
Instance Method Summary collapse
- #execute(args, full_args, klasses) ⇒ Object
-
#initialize(instance, block) ⇒ Command
constructor
A new instance of Command.
Methods included from Base
#assign_arguments_from, #assign_options_from, #assign_toggles_from, #create_variable_and_method_from, #ensure_parameters_defined!, #hidden?, #process_args, #sub_command?
Methods included from Helper
#available_params_for, #display_help_for, #display_help_if_requested, #help, #help_requested?, #inverse_toggle_arg?, #option_or_toggle?, #sub_command?
Constructor Details
#initialize(instance, block) ⇒ Command
Returns a new instance of Command.
8 9 10 11 |
# File 'lib/brigadier/commands/command.rb', line 8 def initialize(instance, block) @instance = instance @block = block end |
Instance Attribute Details
#instance ⇒ Object (readonly)
Returns the value of attribute instance.
6 7 8 |
# File 'lib/brigadier/commands/command.rb', line 6 def instance @instance end |
Instance Method Details
#execute(args, full_args, klasses) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/brigadier/commands/command.rb', line 13 def execute(args, full_args, klasses) process_args(args, instance) assign_toggles_from(available_toggles) () assign_arguments_from(available_arguments) # FIXME objs = (full_args.count == 1) ? klasses : klass return if display_help_if_requested(objs, full_args) ensure_parameters_defined!(, available_arguments) instance.instance_eval(&block) end |