Module: Tenjin::SafeHelper
- Included in:
- Context
- Defined in:
- lib/tenjin.rb
Class Method Summary collapse
-
.safe_escape(val) ⇒ Object
escape val only if val is not SafeString object, and return SafeString object.
-
.safe_str(s) ⇒ Object
return SafeString object.
-
.safe_str?(s) ⇒ Boolean
return true if s is SafeString object.
Class Method Details
.safe_escape(val) ⇒ Object
escape val only if val is not SafeString object, and return SafeString object
217 218 219 |
# File 'lib/tenjin.rb', line 217 def safe_escape(val) safe_str?(val) ? val : safe_str(escape(val)) end |
.safe_str(s) ⇒ Object
return SafeString object
207 208 209 |
# File 'lib/tenjin.rb', line 207 def safe_str(s) SafeString.new(s.to_s) end |
.safe_str?(s) ⇒ Boolean
return true if s is SafeString object
212 213 214 |
# File 'lib/tenjin.rb', line 212 def safe_str?(s) s.is_a?(SafeString) end |