Module: ConvenientService::Service::Plugins::HasJSendResult::Entities::Result::Plugins::HasPatternMatchingSupport::Concern Private
- Includes:
- ConvenientService::Support::Concern
- Defined in:
- lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_pattern_matching_support/concern.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
Methods included from ConvenientService::Support::Concern
Instance Method Details
#deconstruct ⇒ Array
Note:
Expected to be called only from pattern matching. Avoid direct usage of this method.
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_pattern_matching_support/concern.rb', line 27 def deconstruct case status.to_sym when :success [status.to_sym, unsafe_data.to_h] when :failure [status.to_sym, .to_s] else # :error [status.to_sym, .to_s] end end |
#deconstruct_keys(keys) ⇒ Hash
Note:
Expected to be called only from pattern matching. Avoid direct usage of this method.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_pattern_matching_support/concern.rb', line 46 def deconstruct_keys(keys) keys ||= [:status, :data, :message, :code, :step, :step_index, :service, :original_service] keys.each_with_object({}) do |key, hash| case key when :status hash[key] = status.to_sym when :data hash[key] = unsafe_data.to_h when :message hash[key] = .to_s when :code hash[key] = unsafe_code.to_sym when :step hash[key] = if step step.service_step? ? step.service_result.service : step.action end when :step_index hash[key] = step&.index when :service hash[key] = service when :original_service hash[key] = original_service end end end |