Sha256: a43a9b8324f9727bae66cdcf8c072579011f9f61cb75e51e495c4348ef956969
Contents?: true
Size: 425 Bytes
Versions: 27
Compression:
Stored size: 425 Bytes
Contents
module Vidar class Interpolation INTERPOLATION_PATTERN = /\{\{(\w+)\}\}/ 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) || ENV[$1] || match # rubocop:disable Style/PerlBackrefs end end end end end
Version data entries
27 entries across 27 versions & 1 rubygems