Class: Lotus::Utils::Escape::SafeString Private

Inherits:
String
  • Object
show all
Defined in:
lib/lotus/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 `Lotus::Helpers` compatibility)
* Leave open the possibility to developers to mark a string as safe with an higher API (eg. `#raw` in `Lotus::View` or `Lotus::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


395
396
397
# File 'lib/lotus/utils/escape.rb', line 395

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


383
384
385
# File 'lib/lotus/utils/escape.rb', line 383

def to_s
  dup
end