Methods

Class Index

Quicksearch

Arrow::HTMLUtilities

A collection of HTML utility functions

Public Instance Methods

escape_html( string ) click to toggle source

Escape special characters in the given string for display in an HTML inspection interface. This escapes common invisible characters like tabs and carriage-returns in additional to the regular HTML escapes.

    # File /Users/ged/source/ruby/Arrow/lib/arrow/mixins.rb, line 88
88:         def escape_html( string )
89:             return "nil" if string.nil?
90:             string = string.inspect unless string.is_a?( String )
91:             string.
92:                 gsub(/&/, '&').
93:                 gsub(/</, '&lt;').
94:                 gsub(/>/, '&gt;').
95:                 gsub(/\n/, '&#8629;').
96:                 gsub(/\t/, '&#8594;')
97:         end

secsequence

--- SEC00077

seccomment

--- ""

method_list

--- 
- methods: 
  - visibility: public
    aref: M000039
    name: escape_html
    sourcecode: "    <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/mixins.rb, line 88</span>\n\
      88:         <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">escape_html</span>( <span class=\"ruby-identifier\">string</span> )\n\
      89:             <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-value str\">&quot;nil&quot;</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">string</span>.<span class=\"ruby-identifier\">nil?</span>\n\
      90:             <span class=\"ruby-identifier\">string</span> = <span class=\"ruby-identifier\">string</span>.<span class=\"ruby-identifier\">inspect</span> <span class=\"ruby-keyword kw\">unless</span> <span class=\"ruby-identifier\">string</span>.<span class=\"ruby-identifier\">is_a?</span>( <span class=\"ruby-constant\">String</span> )\n\
      91:             <span class=\"ruby-identifier\">string</span>.\n\
      92:                 <span class=\"ruby-identifier\">gsub</span>(<span class=\"ruby-regexp re\">/&amp;/</span>, <span class=\"ruby-value str\">'&amp;amp;'</span>).\n\
      93:                 <span class=\"ruby-identifier\">gsub</span>(<span class=\"ruby-regexp re\">/&lt;/</span>, <span class=\"ruby-value str\">'&amp;lt;'</span>).\n\
      94:                 <span class=\"ruby-identifier\">gsub</span>(<span class=\"ruby-regexp re\">/&gt;/</span>, <span class=\"ruby-value str\">'&amp;gt;'</span>).\n\
      95:                 <span class=\"ruby-identifier\">gsub</span>(<span class=\"ruby-regexp re\">/\\n/</span>, <span class=\"ruby-value str\">'&amp;#8629;'</span>).\n\
      96:                 <span class=\"ruby-identifier\">gsub</span>(<span class=\"ruby-regexp re\">/\\t/</span>, <span class=\"ruby-value str\">'&amp;#8594;'</span>)\n\
      97:         <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Escape special characters in the given <tt>string</tt> for display in an
      HTML inspection interface. This escapes common invisible characters like
      tabs and carriage-returns in additional to the regular HTML escapes.
      </p>
    params: ( string )
  category: Instance
  type: Public

sectitle

--- 

[Validate]

Generated with the Darkfish Rdoc Generator.