Class: HtmlInspector

Inherits:
Object show all
Defined in:
lib/html_inspector/load.rb,
lib/html_inspector/escape.rb

Constant Summary collapse

ESCAPE_TABLE =
{ '&'=>'&amp;', '<'=>'&lt;', '>'=>'&gt;', '"'=>'&quot;', "'"=>'&#039;', }

Class Method Summary collapse

Class Method Details

.escape(data) ⇒ Object



5
6
7
# File 'lib/html_inspector/escape.rb', line 5

def escape(data)
  data.to_s.gsub(/[&<>"]/) {|s| ESCAPE_TABLE[s] }
end

.load_core_extObject



3
4
5
6
7
8
9
# File 'lib/html_inspector/load.rb', line 3

def load_core_ext
  core_ext = File.expand_path(File.join(File.dirname(__FILE__), 'core_ext'))
  Dir.glob(File.join(core_ext, '*.rb')) do |file|
    file.match(/^.+\/([^\/]+)\.rb$/)
    require "html_inspector/core_ext/#{$1}"
  end
end