Sha256: 8abf834876fe701263ae2acdd0cf69fcd118b0c4bdd371294814ca576357e1b6
Contents?: true
Size: 664 Bytes
Versions: 7
Compression:
Stored size: 664 Bytes
Contents
require "string-cases" # This class doesnt hold other methods than for autoloading of subclasses. class HtmlGen # Autoloader for subclasses. 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 # Escapes HTML from the given string. This is to avoid any dependencies and should not be used by other libs. def self.escape_html(string) string.to_s.gsub(/&/, "&").gsub(/\"/, """).gsub(/>/, ">").gsub(/</, "<") end end
Version data entries
7 entries across 7 versions & 1 rubygems