Module: AyeCommander::Commander
Overview
Commander is a special command that lets you run several command in a succession. At the end it returns its own result containing a hash with the commands run.
Defined Under Namespace
Modules: ClassMethods
Constant Summary
Constants included from Limitable::ClassMethods
Limitable::ClassMethods::LIMITERS
Constants included from Hookable::ClassMethods
Instance Attribute Summary
Attributes included from Status::Writeable
Attributes included from Status::Readable
Instance Method Summary collapse
-
#call ⇒ Object
This is the default call for a commander It basically just executes the commands saved in the executes array.
-
#initialize(**args) ⇒ Object
A commander works with the following instance variables: command: The last executed command.
Methods included from ClassMethods
abort_on_failure, abort_on_failure?, command, executes, included, inherited, prepare_commander_result
Methods included from Status::ClassMethods
Methods included from Shareable::ClassMethods
Methods included from Resultable::ClassMethods
#new_result, #result, #result_class
Methods included from Limitable::ClassMethods
#limiters, #readers, #uses, #validate_arguments, #validate_received_arguments, #validate_received_arguments?, #validate_required_arguments, #validate_required_arguments?
Methods included from Ivar::ClassMethods
#at, #define_missing_reader, #eq, #to_ivar, #to_nvar
Methods included from Abortable::ClassMethods
Methods included from Status::Writeable
Methods included from Status::Readable
Methods included from Ivar::Writeable
Methods included from Ivar::Readable
#method_missing, #remove!, #to_ivar, #to_nvar
Methods included from Inspectable
#inspect, #pretty_print, #sorted_instance_variables, #to_hash, #to_result_hash
Methods included from Abortable
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class AyeCommander::Ivar::Writeable
Instance Method Details
#call ⇒ Object
This is the default call for a commander It basically just executes the commands saved in the executes array. This however can be overwritten by the user and define their own logic to execute different commands
95 96 97 |
# File 'lib/aye_commander/commander.rb', line 95 def call execute(*self.class.executes, abort_on_failure: true) end |
#initialize(**args) ⇒ Object
A commander works with the following instance variables: command: The last executed command. Will be an anonymous empty command at
the beginning
executed: An array containing the executed commands
87 88 89 |
# File 'lib/aye_commander/commander.rb', line 87 def initialize(**args) super(command: self.class.command.new(args), executed: []) end |