Class: Minibars::SafeString

Inherits:
Object
  • Object
show all
Defined in:
lib/minibars/safe_string.rb

Overview

Mark a string as safe to avoid it being escaped by Handlebars

Instance Method Summary collapse

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_jsonObject

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