class TaintedLove::Replacer::ReplaceString
Constants
- WRAP_METHODS
Public Class Methods
wrap_call(name)
click to toggle source
Calls superclass method
# File lib/tainted_love/replacer/replace_string.rb, line 10 def self.wrap_call(name) define_method(name) do |*args, &block| return super(*args, &block) unless tainted? || args.any?(&:tainted?) result = super(*args, &block) result.tainted_love_tags += tainted_love_tags if tainted? args.select(&:tainted?).each do |arg| result.tainted_love_tags += arg.tainted_love_tags end result end end
Public Instance Methods
replace!()
click to toggle source
# File lib/tainted_love/replacer/replace_string.rb, line 8 def replace! mod = Module.new do def self.wrap_call(name) define_method(name) do |*args, &block| return super(*args, &block) unless tainted? || args.any?(&:tainted?) result = super(*args, &block) result.tainted_love_tags += tainted_love_tags if tainted? args.select(&:tainted?).each do |arg| result.tainted_love_tags += arg.tainted_love_tags end result end end WRAP_METHODS.each do |sym| wrap_call(sym) end def split(*args) result = super(*args) if tainted? result.each do |value| value.taint.tainted_love_tags += tainted_love_tags end end result end end String.prepend(mod) end
split(*args)
click to toggle source
Calls superclass method
# File lib/tainted_love/replacer/replace_string.rb, line 30 def split(*args) result = super(*args) if tainted? result.each do |value| value.taint.tainted_love_tags += tainted_love_tags end end result end