From 3ec047da4802ce31692811520531e64ccf977188 Mon Sep 17 00:00:00 2001 From: Marian13 Date: Tue, 5 Dec 2023 23:51:06 +0200 Subject: [PATCH] docs(code): add link to faq --- .../entities/code/concern/instance_methods.rb | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/concern/instance_methods.rb b/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/concern/instance_methods.rb index 9844b33b781..12451c1157d 100644 --- a/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/concern/instance_methods.rb +++ b/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/concern/instance_methods.rb @@ -69,6 +69,30 @@ def ==(other) # @see https://rspec.info/documentation/3.12/rspec-mocks/RSpec/Mocks/ArgumentMatchers.html # @see https://github.com/rspec/rspec-mocks/blob/v3.12.3/lib/rspec/mocks/argument_matchers.rb#L282 # + # @example Just code does NOT work in case/when. + # + # case result.code # `result.code` returns fancy object + # when :full_queue + # notify_devops + # when :duplicated_job + # notify_devs + # else + # # ... + # end + # + # @example Code converted to symbol works in case/when. + # + # case result.code.to_sym + # when :full_queue + # notify_devops + # when :duplicated_job + # notify_devs + # else + # # ... + # end + # + # @see https://userdocs.convenientservice.org/faq#why-casewhen-does-not-work-with-just-result-codes + # # @internal # IMPORTANT: Must be kept in sync with `#==`. # NOTE: Ruby does NOT have `!==` operator.