Class: SB

Inherits:
String show all
Defined in:
lib/sb.rb,
lib/sb/version.rb

Constant Summary collapse

VERSION =
"0.1.0"

Instance Method Summary collapse

Methods inherited from String

#dump

Instance Method Details

#<<(str) ⇒ Object

Public: Append a string, making sure that it’s escaped if it’s not a “safe” string (i.e. not an instance of SB).

str - A String.

Returns self.



11
12
13
# File 'lib/sb.rb', line 11

def <<(str)
  super(SB === str ? str : SB(Hache.h(str)))
end

#to_sObject

Public: Make sure converting this into a string doesn’t mark it as unsafe.



16
17
18
# File 'lib/sb.rb', line 16

def to_s
  self
end