Class: Foobara::CommandConnectors::Http::Commands::Help
- Inherits:
-
Foobara::Command
- Object
- Foobara::Command
- Foobara::CommandConnectors::Http::Commands::Help
- Defined in:
- foobara-http-command-connector-0.0.23/src/http/commands/help.rb,
foobara-http-command-connector-0.0.23/src/http/commands/help/presenter.rb,
foobara-http-command-connector-0.0.23/src/http/commands/help/presenter/root.rb,
foobara-http-command-connector-0.0.23/src/http/commands/help/presenter/type.rb,
foobara-http-command-connector-0.0.23/src/http/commands/help/presenter/error.rb,
foobara-http-command-connector-0.0.23/src/http/commands/help/presenter/model.rb,
foobara-http-command-connector-0.0.23/src/http/commands/help/presenter/domain.rb,
foobara-http-command-connector-0.0.23/src/http/commands/help/presenter/entity.rb,
foobara-http-command-connector-0.0.23/src/http/commands/help/presenter/command.rb,
foobara-http-command-connector-0.0.23/src/http/commands/help/result_serializer.rb,
foobara-http-command-connector-0.0.23/src/http/commands/help/presenter/processor.rb,
foobara-http-command-connector-0.0.23/src/http/commands/help/presenter/organization.rb,
foobara-http-command-connector-0.0.23/src/http/commands/help/presenter/request_failed.rb,
foobara-http-command-connector-0.0.23/src/http/commands/help/presenter/processor_class.rb
Defined Under Namespace
Classes: Presenter, ResultSerializer
Constant Summary
Constants included from TruncatedInspect
Instance Attribute Summary collapse
-
#manifest_to_help_with ⇒ Object
Returns the value of attribute manifest_to_help_with.
-
#object_to_help_with ⇒ Object
Returns the value of attribute object_to_help_with.
-
#raw_manifest ⇒ Object
Returns the value of attribute raw_manifest.
-
#root_manifest ⇒ Object
Returns the value of attribute root_manifest.
Attributes included from Foobara::CommandPatternImplementation::Concerns::Subcommands
Attributes included from Foobara::CommandPatternImplementation::Concerns::Runtime
Attributes included from Foobara::CommandPatternImplementation::Concerns::Errors
Attributes included from Foobara::CommandPatternImplementation::Concerns::Inputs
Instance Method Summary collapse
- #command_connector ⇒ Object
- #determine_object_to_help_with(mode: Namespace::LookupMode::ABSOLUTE) ⇒ Object
- #execute ⇒ Object
- #load_manifest ⇒ Object
- #set_manifest_to_help_with ⇒ Object
Methods inherited from Foobara::Command
Methods included from Foobara::Concern
foobara_class_methods_module_for, foobara_concern?, included
Methods included from Foobara::CommandPatternImplementation::Concerns::Reflection
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
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
Methods included from Foobara::CommandPatternImplementation::Concerns::Runtime
#halt!, #run, #run!, #run_execute, #succeed, #success?, #validate, #validate_records
Methods included from Foobara::CommandPatternImplementation::Concerns::Errors
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
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Foobara::CommandPatternImplementation::Concerns::Inputs
Instance Attribute Details
#manifest_to_help_with ⇒ Object
Returns the value of attribute manifest_to_help_with.
19 20 21 |
# File 'foobara-http-command-connector-0.0.23/src/http/commands/help.rb', line 19 def manifest_to_help_with @manifest_to_help_with end |
#object_to_help_with ⇒ Object
Returns the value of attribute object_to_help_with.
19 20 21 |
# File 'foobara-http-command-connector-0.0.23/src/http/commands/help.rb', line 19 def object_to_help_with @object_to_help_with end |
#raw_manifest ⇒ Object
Returns the value of attribute raw_manifest.
19 20 21 |
# File 'foobara-http-command-connector-0.0.23/src/http/commands/help.rb', line 19 def raw_manifest @raw_manifest end |
#root_manifest ⇒ Object
Returns the value of attribute root_manifest.
19 20 21 |
# File 'foobara-http-command-connector-0.0.23/src/http/commands/help.rb', line 19 def root_manifest @root_manifest end |
Instance Method Details
#command_connector ⇒ Object
63 64 65 |
# File 'foobara-http-command-connector-0.0.23/src/http/commands/help.rb', line 63 def command_connector request.command_connector end |
#determine_object_to_help_with(mode: Namespace::LookupMode::ABSOLUTE) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'foobara-http-command-connector-0.0.23/src/http/commands/help.rb', line 26 def determine_object_to_help_with(mode: Namespace::LookupMode::ABSOLUTE) arg = request.argument if arg result = command_connector.command_registry.(arg, mode:) if result self.object_to_help_with = result else # TODO: we should look up from the command connector's namespace instead, right? result = GlobalOrganization.(arg, mode:) if result && root_manifest.contains?(result., result.scoped_category) self.object_to_help_with = result elsif mode == Namespace::LookupMode::ABSOLUTE determine_object_to_help_with(mode: Namespace::LookupMode::GENERAL) elsif mode == Namespace::LookupMode::GENERAL determine_object_to_help_with(mode: Namespace::LookupMode::RELAXED) else # TODO: add an input error instead for missing record to trigger 404 add_runtime_error(CommandConnector::NotFoundError.for(arg)) end end else self.object_to_help_with = root_manifest end end |
#execute ⇒ Object
11 12 13 14 15 16 17 |
# File 'foobara-http-command-connector-0.0.23/src/http/commands/help.rb', line 11 def execute load_manifest determine_object_to_help_with set_manifest_to_help_with manifest_to_help_with end |
#load_manifest ⇒ Object
21 22 23 24 |
# File 'foobara-http-command-connector-0.0.23/src/http/commands/help.rb', line 21 def load_manifest self.raw_manifest = command_connector. self.root_manifest = Manifest::RootManifest.new(raw_manifest) end |
#set_manifest_to_help_with ⇒ Object
55 56 57 58 59 60 61 |
# File 'foobara-http-command-connector-0.0.23/src/http/commands/help.rb', line 55 def set_manifest_to_help_with self.manifest_to_help_with = if object_to_help_with.is_a?(Manifest::BaseManifest) object_to_help_with else root_manifest.lookup(object_to_help_with.) end end |