Method: Volt::ModelController#raw
- Defined in:
- lib/volt/controllers/model_controller.rb
#raw(str) ⇒ Object
Raw marks a string as html safe, so bindings can be rendered as html. With great power comes great responsibility.
231 232 233 234 235 236 237 238 239 240 241 |
# File 'lib/volt/controllers/model_controller.rb', line 231 def raw(str) # Promises need to have .to_s called using .then, since .to_s is a promise # method, so it won't be passed down to the value. if str.is_a?(Promise) str = str.then(&:to_s) else str = str.to_s unless str.is_a?(String) end str.html_safe end |