Sha256: 4c0d546c9256a829ef68847258b400c42bf93b863d79eff579f6c11bd494e928
Contents?: true
Size: 644 Bytes
Versions: 15
Compression:
Stored size: 644 Bytes
Contents
# coding: utf-8 # frozen_string_literal: true module Stealth class ServiceReply attr_accessor :recipient_id, :replies def initialize(recipient_id:, yaml_reply:, context:) @recipient_id = recipient_id begin erb_reply = ERB.new(yaml_reply).result(context) rescue NameError => e raise(Stealth::Errors::UndefinedVariable, e.message) end @replies = load_replies(YAML.load(erb_reply)) end private def load_replies(unstructured_replies) unstructured_replies.collect do |reply| Stealth::Reply.new(unstructured_reply: reply) end end end end
Version data entries
15 entries across 15 versions & 1 rubygems