module I18n::Tasks::StringInterpolation
Public Instance Methods
interpolate_soft(s, t = {})
click to toggle source
# File lib/i18n/tasks/string_interpolation.rb, line 7 def interpolate_soft(s, t = {}) return s unless s t.each do |k, v| pat = "%{#{k}}" s = s.gsub pat, v.to_s if s.include?(pat) end s end