module Marta::UserValuePrework
Marta
can parse strings like “hello #{value}”
Private Instance Methods
process_string(str='', requestor = self)
click to toggle source
Marta
can parse strings like “hello #{value}”
# File lib/marta/user_values_prework.rb, line 9 def process_string(str='', requestor = self) str ||= "" n = nil while str != n str = n if !n.nil? thevar = str.match(/\#{@+[^\#{@]*}/).to_s if thevar != "" value = requestor.instance_variable_get thevar.match(/@.*[^}]/).to_s n = str.gsub(thevar, value) else n = str end end str end