cdata_section

cdata_section(content)
Instance Public methods

Returns a CDATA section with the given content. CDATA sections are used to escape blocks of text containing characters which would otherwise be recognized as markup. CDATA sections begin with the string <![CDATA[ and end with (and may not contain) the string ]]>.

1
2
3
4
5
6
7
8
cdata_section("<hello world>")
# => <![CDATA[<hello world>]]>
 
cdata_section(File.read("hello_world.txt"))
# => <![CDATA[<hello from a text file]]>
 
cdata_section("hello]]>world")
# => <![CDATA[hello]]]]><![CDATA[>world]]>
doc_ruby_on_rails
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.