Sha256: 4765507c824fb0854b6eacfe167e2e5b7b8dabeeab0a7482cb88ec3d2fcc0022
Contents?: true
Size: 421 Bytes
Versions: 33
Compression:
Stored size: 421 Bytes
Contents
module Vidar class Interpolation INTERPOLATION_PATTERN = /\{\{(\w+)\}\}/.freeze class << self def call(string, getter) return unless string fail ArgumentError, "getter must respond_to get." unless getter.respond_to?(:get) string.gsub(INTERPOLATION_PATTERN) do |match| getter.get($1) || match # rubocop:disable Style/PerlBackrefs end end end end end
Version data entries
33 entries across 33 versions & 1 rubygems