lib/kbam.rb
#takes only an array of values
takes only an array of values
takes only an array of values
def replace(string, values)
		warning "DEPRECATED: use class method instead"
		i = 0
		last_value = nil
		replaced_string = string.to_s.gsub(/\?/) do |match|
			if i > 0
				if values[i] != nil
					last_value = replacement = self.class.sanatize values[i]
				else
					replacement = last_value
				end
			else
				unless values[i] != nil
					puts "missing argument!"
				else
					last_value = replacement  = self.class.sanatize values[i]
				end
			end
			i += 1
			replacement
		end
		return replaced_string
	end
def replace ( string , values ) warning "DEPRECATED: use class method instead" i = 0 last_value = nil replaced_string = string . to_s . gsub ( / \? / ) do | match | if i > 0 if values [ i ] != nil last_value = replacement = self . class . sanatize values [ i ] else replacement = last_value end else unless values [ i ] != nil puts "missing argument!" else last_value = replacement = self . class . sanatize values [ i ] end end i += 1 replacement end return replaced_string end
takes only an array of values
takes only an array of values
string
values