Class: ConvenientService::Service::Plugins::CollectsServicesInException::Commands::ExtractServiceDetails
- Inherits:
-
ConvenientService::Support::Command
- Object
- ConvenientService::Support::Command
- ConvenientService::Service::Plugins::CollectsServicesInException::Commands::ExtractServiceDetails
- Defined in:
- lib/convenient_service/service/plugins/collects_services_in_exception/commands/extract_service_details.rb
Instance Attribute Summary collapse
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Instance Method Summary collapse
- #call ⇒ Hash{Symbol => Object}
- #first_not_completed_step ⇒ ConvenientService::Service::Plugins::CanHaveSteps::Entities::Step?
- #initialize(service:, method:) ⇒ void constructor
- #trigger ⇒ Hash{Symbol => Object}
Methods inherited from ConvenientService::Support::Command
Constructor Details
#initialize(service:, method:) ⇒ void
25 26 27 28 |
# File 'lib/convenient_service/service/plugins/collects_services_in_exception/commands/extract_service_details.rb', line 25 def initialize(service:, method:) @service = service @method = method end |
Instance Attribute Details
#method ⇒ Object (readonly)
Returns the value of attribute method.
19 20 21 |
# File 'lib/convenient_service/service/plugins/collects_services_in_exception/commands/extract_service_details.rb', line 19 def method @method end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
13 14 15 |
# File 'lib/convenient_service/service/plugins/collects_services_in_exception/commands/extract_service_details.rb', line 13 def service @service end |
Instance Method Details
#call ⇒ Hash{Symbol => Object}
33 34 35 |
# File 'lib/convenient_service/service/plugins/collects_services_in_exception/commands/extract_service_details.rb', line 33 def call {instance: service, trigger: trigger} end |
#first_not_completed_step ⇒ ConvenientService::Service::Plugins::CanHaveSteps::Entities::Step?
56 57 58 |
# File 'lib/convenient_service/service/plugins/collects_services_in_exception/commands/extract_service_details.rb', line 56 def first_not_completed_step Utils.memoize_including_falsy_values(self, :@first_not_completed_step) { service.steps.find(&:not_completed?) } end |
#trigger ⇒ Hash{Symbol => Object}
45 46 47 48 49 50 51 |
# File 'lib/convenient_service/service/plugins/collects_services_in_exception/commands/extract_service_details.rb', line 45 def trigger return {method: ":#{method}"} if method != :result return {method: ":result"} if service.steps.none? return {step: "Unknown Step", index: -1} unless first_not_completed_step {step: first_not_completed_step.printable_action, index: first_not_completed_step.index} end |