Sha256: 197812d1da3003d566d79f448c4fd892dc9113c9b8fe63d29e9872aa0c040f88
Contents?: true
Size: 672 Bytes
Versions: 2
Compression:
Stored size: 672 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.exists?(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) return string.to_s.gsub(/&/, "&").gsub(/\"/, """).gsub(/>/, ">").gsub(/</, "<") end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
html_gen-0.0.7 | lib/html_gen.rb |
html_gen-0.0.6 | lib/html_gen.rb |