Sha256: f9bc9c613e987395557dc86681ec434a5371c1a58f3749f4c89f60ce27172911
Contents?: true
Size: 460 Bytes
Versions: 15
Compression:
Stored size: 460 Bytes
Contents
module R10K; end module R10K::Util; end module R10K::Util::Interp # Interpolate a string with a given scope # # @param [String] string # @param [Hash] scope # # @return [String] def interpolate_string(string, scope) interp = string.clone while (matchdata = interp.match /%\{.+?\}/) var_name = matchdata[1].intern var_data = scope[var_name] interp.gsub!(/%\{#{var_name}\}/, var_data) end interp end end
Version data entries
15 entries across 15 versions & 1 rubygems