What is a step raw input?
A step raw input passes a literal value from the class scope to a step, without calling any organizer method. It is written as
{step_parameter_name: raw(value)}inin:.class CalculateDoubled include ConvenientService::Standard::Config attr_reader :number def initialize(number:) @number = number end def result success(doubled: number * 2) end end class AwardLoyaltyPoints include ConvenientService::Standard::Config step CalculateDoubled, in: {number: raw(21)}, out: {doubled: :points} end result = AwardLoyaltyPoints.result result.success? # => true result.data[:points] # => 42rawis a class method - it can wrap anything available in the enclosing class scope: literals, constants, other class methods.The wrapped value is forwarded as-is, without any intermediate processing - no organizer method is called for it. Unlike a usual step input or a step alias input,
AwardLoyaltyPointsabove does not need any instance method at all to supplynumber:.Use a step raw input when a step needs a fixed value that does not depend on the organizer instance - for example, a constant or a value derived from the class itself.
Compare with a step proc input, which evaluates its value in the organizer's instance scope instead of the class scope.
See also
- What step input types are available?
- What is a usual step input?
- What is a step alias input?
- What is a step proc input?
- What is a step?