Class: Minibars::SafeString
- Inherits:
-
Object
- Object
- Minibars::SafeString
- Defined in:
- lib/minibars/safe_string.rb
Overview
Mark a string as safe to avoid it being escaped by Handlebars
Instance Method Summary collapse
-
#initialize(string) ⇒ SafeString
constructor
A new instance of SafeString.
- #to_json ⇒ Object private
Constructor Details
#initialize(string) ⇒ SafeString
Returns a new instance of SafeString.
4 5 6 |
# File 'lib/minibars/safe_string.rb', line 4 def initialize(string) @string = string end |
Instance Method Details
#to_json ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
9 10 11 |
# File 'lib/minibars/safe_string.rb', line 9 def to_json(*) "new Handlebars.SafeString(#{@string.to_json})" end |