Sha256: 8a8e9554e8e89529d431063977c1498a3c6a1b192b9a4106804c9234985c6980
Contents?: true
Size: 962 Bytes
Versions: 3
Compression:
Stored size: 962 Bytes
Contents
module Hyde module Utils protected def escape_html(str) str. gsub('&', '&'). gsub('"', '"'). gsub('<', '<'). gsub('>', '>'). gsub("'", '&39;') end def same_file?(a, b) File.expand_path(a) == File.expand_path(b) end def matches_files?(needle, haystack) haystack.inject(false) do |a, match| a ||= same_file?(needle, match) end end def force_file_open(filepath, &blk) require 'fileutils' FileUtils.mkdir_p File.dirname(filepath) if block_given? File.open filepath, 'w', &blk else File.new filepath, 'w' end end # Returns all helper classes under the Hyde::Helpers module. def get_helpers Hyde::Helpers.constants.inject([Hyde::Helpers]) do |a, constant| mod = Hyde::Helpers.const_get(constant) a << mod if mod.is_a? Module a end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hydeweb-0.0.8.pre2 | lib/hyde/utils.rb |
hydeweb-0.0.8.pre1 | lib/hyde/utils.rb |
hydeweb-0.0.7 | lib/hyde/utils.rb |