Class: CompEx::UnsafeString
- Inherits:
-
Object
- Object
- CompEx::UnsafeString
- Defined in:
- lib/compex/unsafe_string.rb
Instance Attribute Summary collapse
-
#escaped ⇒ Object
readonly
Returns the value of attribute escaped.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
-
#initialize(value) ⇒ UnsafeString
constructor
A new instance of UnsafeString.
- #to_s ⇒ Object
Constructor Details
#initialize(value) ⇒ UnsafeString
Returns a new instance of UnsafeString.
7 8 9 10 11 12 13 14 15 |
# File 'lib/compex/unsafe_string.rb', line 7 def initialize(value) if value.is_a? UnsafeString @raw = value.raw @escaped = value.escaped else @raw = value @escaped = ERB::Util.html_escape(raw) end end |
Instance Attribute Details
#escaped ⇒ Object (readonly)
Returns the value of attribute escaped.
5 6 7 |
# File 'lib/compex/unsafe_string.rb', line 5 def escaped @escaped end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
5 6 7 |
# File 'lib/compex/unsafe_string.rb', line 5 def raw @raw end |
Instance Method Details
#to_s ⇒ Object
17 |
# File 'lib/compex/unsafe_string.rb', line 17 def to_s = @escaped |