Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/tagtreescanner.rb
Overview
Extensions to the built-in String class
Instance Method Summary collapse
-
#xmlsafe ⇒ Object
Returns a copy of the string with all
&,<and>characters replaced by their equivalent XML entities (&,<, and>). -
#xmlsafe! ⇒ Object
Modifies the string, replacing all
&,<and>characters with their equivalent XML entities (&,<, and>).
Instance Method Details
#xmlsafe ⇒ Object
Returns a copy of the string with all &, < and > characters replaced by their equivalent XML entities (&, <, and >)
690 691 692 |
# File 'lib/tagtreescanner.rb', line 690 def xmlsafe self.dup.xmlsafe! end |
#xmlsafe! ⇒ Object
Modifies the string, replacing all &, < and > characters with their equivalent XML entities (&, <, and >)
697 698 699 700 701 702 |
# File 'lib/tagtreescanner.rb', line 697 def xmlsafe! self.gsub!( /&/, '&' ) self.gsub!( /</, '<' ) self.gsub!( />/, '>' ) self end |