Class: ConvenientService::Service::Plugins::CollectsServicesInException::Commands::ExtractServiceDetails

Inherits:
ConvenientService::Support::Command show all
Defined in:
lib/convenient_service/service/plugins/collects_services_in_exception/commands/extract_service_details.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ConvenientService::Support::Command

[], call

Constructor Details

#initialize(service:, method:) ⇒ void

Parameters:



30
31
32
33
# File 'lib/convenient_service/service/plugins/collects_services_in_exception/commands/extract_service_details.rb', line 30

def initialize(service:, method:)
  @service = service
  @method = method
end

Instance Attribute Details

#methodObject (readonly)

Returns the value of attribute method.



24
25
26
# File 'lib/convenient_service/service/plugins/collects_services_in_exception/commands/extract_service_details.rb', line 24

def method
  @method
end

#serviceObject (readonly)

Returns the value of attribute service.



18
19
20
# File 'lib/convenient_service/service/plugins/collects_services_in_exception/commands/extract_service_details.rb', line 18

def service
  @service
end

Instance Method Details

#callHash{Symbol => Object}

Returns:

  • (Hash{Symbol => Object})


38
39
40
# File 'lib/convenient_service/service/plugins/collects_services_in_exception/commands/extract_service_details.rb', line 38

def call
  {instance: service, trigger: trigger}
end

#first_not_evaluated_stepConvenientService::Service::Plugins::CanHaveSteps::Entities::Step?



61
62
63
# File 'lib/convenient_service/service/plugins/collects_services_in_exception/commands/extract_service_details.rb', line 61

def first_not_evaluated_step
  Utils.memoize_including_falsy_values(self, :@first_not_evaluated_step) { service.steps.find(&:not_evaluated?) }
end

#triggerHash{Symbol => Object}

Returns:

  • (Hash{Symbol => Object})


50
51
52
53
54
55
56
# File 'lib/convenient_service/service/plugins/collects_services_in_exception/commands/extract_service_details.rb', line 50

def trigger
  return {method: ":#{method}"} if method != :result
  return {method: ":result"} if service.steps.none?
  return {step: "Unknown Step", index: -1} unless first_not_evaluated_step

  {step: first_not_evaluated_step.printable_action, index: first_not_evaluated_step.index}
end