Module: Rabl::Helpers::Escaper
- Included in:
- Engine
- Defined in:
- lib/rabl/helpers.rb
Instance Method Summary collapse
Instance Method Details
#escape_output(response) ⇒ Object
163 164 165 166 167 168 169 170 171 172 |
# File 'lib/rabl/helpers.rb', line 163 def escape_output(response) case response when Hash response.each{|k,v| response[k] = escape_value(v) } when Array response.map!{|v| escape_value(v) } else response end end |
#escape_value(value) ⇒ Object
174 175 176 177 178 179 180 181 182 183 |
# File 'lib/rabl/helpers.rb', line 174 def escape_value(value) case value when String ERB::Util.h(value) when Array, Hash escape_output(value) else value end end |