Exception: ConvenientService::Service::Plugins::CanHaveStepAwareEnumerables::Exceptions::InvalidEvaluateByValue Private

Inherits:
Exception
  • Object
show all
Defined in:
lib/convenient_service/service/plugins/can_have_step_aware_enumerables/exceptions.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.0

Instance Method Summary collapse

Methods inherited from Exception

new

Instance Method Details

#initialize_with_kwargs(value:) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:

  • value (Object)

    Can be any type.

Since:

  • 1.0.0



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/convenient_service/service/plugins/can_have_step_aware_enumerables/exceptions.rb', line 65

def initialize_with_kwargs(value:)
  message = <<~TEXT
    `evaluate_by` value `#{value}` is NOT supported.

    Here are some examples of valid values:
      # `Symbol` value.
      .result(evaluate_by: :to_a)

      # `String` value.
      .result(evaluate_by: "to_h")

      # `Proc` value.
      .result(evaluate_by: ->(enumerable) { enumerable.to_set })

      # Object that respond to `call`.
      class Evaluator
        def self.call(enumerable)
          enumerable.to_s
        end
      end

      .result(evaluate_by: Evaluator)

      # Pass `nil` to skip evaluation (NOT recommended for enumerators).
      .result(evaluate_by: nil)
  TEXT

  initialize(message)
end