Sha256: 877fb85a53f28ae6154429fe75792f63962db25b296673219c4b47f4a97da4f6
Contents?: true
Size: 865 Bytes
Versions: 6
Compression:
Stored size: 865 Bytes
Contents
# frozen_string_literal: true module Floe class Workflow class PayloadTemplate def initialize(payload) @payload = payload end def value(context, inputs = {}) interpolate_value_nested(payload, context, inputs) end private attr_reader :payload def interpolate_value_nested(value, context, inputs) case value when Array value.map { |val| interpolate_value_nested(val, context, inputs) } when Hash value.to_h do |key, val| val = interpolate_value_nested(val, context, inputs) key = key.gsub(/\.\$$/, "") if key.end_with?(".$") [key, val] end when String value.start_with?("$") ? Path.value(value, context, inputs) : value else value end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems