module Rabl::Helpers::Escaper
Public Instance Methods
escape_output(response)
click to toggle source
Returns escaped copies; the response may be shared with the cache, so it is never changed in place.
# File lib/rabl/helpers.rb, line 188 def escape_output(response) case response when Hash escaped = response.dup response.each { |k, v| escaped[k] = escape_value(v) } escaped when Array response.dup.map! { |v| escape_value(v) } else response end end
escape_value(value)
click to toggle source
# File lib/rabl/helpers.rb, line 201 def escape_value(value) case value when String ERB::Util.h(value) when Array, Hash escape_output(value) else value end end