Sha256: 88efaf9e3829df6e20a7e42180128ed4ffe97097ba9b0430645bd6871ac2f8cb
Contents?: true
Size: 375 Bytes
Versions: 6
Compression:
Stored size: 375 Bytes
Contents
def subs(config,data) reg = Regexp.new(config["regex"]) to = config["to"] attribute = config['attribute'] data.map! do |i| if attribute if i.respond_to?(attribute) && i.respond_to?("#{attribute}=") i.__send__("#{attribute}=", i.__send__("#{attribute}").gsub(reg, to)) end else i = i.gsub(reg,to) end i end return data end
Version data entries
6 entries across 6 versions & 1 rubygems