class HtmlGen

This class doesnt hold other methods than for autoloading of subclasses.

Public Class Methods

const_missing(name) click to toggle source

Autoloader for subclasses.

Calls superclass method
# File lib/html_gen.rb, line 6
def self.const_missing(name)
  file_path = "#{File.dirname(__FILE__)}/html_gen/#{::StringCases.camel_to_snake(name)}.rb"

  if File.exist?(file_path)
    require file_path
    return HtmlGen.const_get(name) if HtmlGen.const_defined?(name)
  end

  super
end
escape_html(string) click to toggle source

Escapes HTML from the given string. This is to avoid any dependencies and should not be used by other libs.

# File lib/html_gen.rb, line 18
def self.escape_html(string)
  string.to_s.gsub(/&/, "&amp;").gsub(/\"/, "&quot;").gsub(/>/, "&gt;").gsub(/</, "&lt;")
end