Class: Foobara::Command

Inherits:
Object
  • Object
show all
Includes:
Concerns::ShortcutForRun, CommandPatternImplementation
Defined in:
foobara-0.0.110/projects/command/src/command.rb,
foobara-0.0.110/projects/command/src/state_machine.rb,
foobara-0.0.110/projects/command/lib/foobara/command.rb,
foobara-0.0.110/projects/command/src/command/concerns/shortcut_for_run.rb

Defined Under Namespace

Modules: Concerns Classes: StateMachine

Constant Summary

Constants included from TruncatedInspect

TruncatedInspect::MAX_LENGTH

Instance Attribute Summary

Attributes included from Foobara::CommandPatternImplementation::Concerns::Subcommands

#is_subcommand

Attributes included from Foobara::CommandPatternImplementation::Concerns::Runtime

#exception, #outcome

Attributes included from Foobara::CommandPatternImplementation::Concerns::Errors

#error_collection

Attributes included from Foobara::CommandPatternImplementation::Concerns::Inputs

#inputs, #raw_inputs

Class Method Summary collapse

Methods included from Concern

foobara_class_methods_module_for, foobara_concern?, included

Methods included from Foobara::CommandPatternImplementation::Concerns::Reflection

#initialize

Methods included from Foobara::CommandPatternImplementation::Concerns::DomainMappers

#domain_map, #domain_map!, #run_mapped_subcommand!

Methods included from Foobara::CommandPatternImplementation::Concerns::Subcommands

#run_subcommand!, #subcommand?

Methods included from Foobara::CommandPatternImplementation::Concerns::Entities

#load_entities, #load_records

Methods included from Foobara::CommandPatternImplementation::Concerns::Transactions

#auto_detect_current_transactions, #commit_transaction, #open_transaction, #opened_transactions, #relevant_entity_classes, #rollback_transaction, #transactions

Methods included from Foobara::CommandPatternImplementation::Concerns::StateMachine

#state_machine

Methods included from Foobara::CommandPatternImplementation::Concerns::Runtime

#execute, #halt!, #run, #run!, #run_execute, #succeed, #success?, #validate, #validate_records

Methods included from Foobara::CommandPatternImplementation::Concerns::Errors

#initialize

Methods included from Foobara::CommandPatternImplementation::Concerns::Inputs

#cast_and_validate_inputs, #initialize, #method_missing, #respond_to_missing?, #respond_to_missing_for_inputs?

Methods included from TruncatedInspect

#inspect, truncating

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Foobara::CommandPatternImplementation::Concerns::Inputs

Class Method Details

.install!Object



7
8
9
# File 'foobara-0.0.110/projects/command/lib/foobara/command.rb', line 7

def install!
  Namespace.global.foobara_add_category_for_subclass_of(:command, self)
end

.reset_allObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'foobara-0.0.110/projects/command/lib/foobara/command.rb', line 11

def reset_all
  to_delete = []

  all.each do |command_class|
    if command_class.name.include?("::")
      parent_name = Util.parent_module_name_for(command_class.name)

      if Object.const_defined?(parent_name)
        command_class.undefine_command_named_function
      else
        to_delete << command_class
      end
    else
      command_class.undefine_command_named_function
    end
  end

  to_delete.each do |command_class|
    all.delete(command_class)
  end

  super
end