Method: String#strip_scripts

Defined in:
lib/source/redshift/request.rb

#strip_scripts(evaluate = false) ⇒ Object

call-seq:

str.strip_scripts(evaluate = false) -> string

Returns a copy of str with the contents of any <script> tags removed. If evaluate is set to true, the stripped scripts will be evaluated.



222
223
224
225
226
227
# File 'lib/source/redshift/request.rb', line 222

def strip_scripts(evaluate = false)
  scripts = ''
  result = `$q(this.__value__.replace(/<script[^>]*>([\\s\\S]*?)<\\/script>/gi,function(){scripts.__value__+=arguments[1]+'\\n';return '';}))`
  Document.execute_js(scripts) if evaluate
  return result
end