Class: Hanami::Utils::Escape::SafeString Private

Inherits:
String
  • Object
show all
Defined in:
lib/hanami/utils/escape.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

The output of an escape.

It’s marked with this special class for two reasons:

* Don't double escape the same string (this is for `Hanami::Helpers`
  compatibility)
* Leave open the possibility to developers to mark a string as safe
  with an higher API (eg. `#raw` in `Hanami::View` or `Hanami::Helpers`)

Since:

  • 0.4.0

Instance Method Summary collapse

Instance Method Details

#encode(*args) ⇒ SafeString

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.

Encode the string the given encoding

Returns:

See Also:

Since:

  • 0.4.0



399
400
401
# File 'lib/hanami/utils/escape.rb', line 399

def encode(*args)
  self.class.new super
end

#to_sSafeString

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.

Returns the duped string.

Returns:

See Also:

Since:

  • 0.4.0



387
388
389
# File 'lib/hanami/utils/escape.rb', line 387

def to_s
  dup
end