Sha256: 0dbfe6a12619811c3f7b9f84a04445567f2d93f423570cba5bc0c87d9b4f4833
Contents?: true
Size: 908 Bytes
Versions: 6
Compression:
Stored size: 908 Bytes
Contents
require "pathname" require "sprockets" require "tilt" module Machined module Utils # Returns a hash of the Tilt templates # that are registered and available to use, where # the key is the extension the template's registered for. def self.available_templates @available_templates ||= {}.tap do |templates| Tilt.mappings.each_key do |ext| begin templates[Sprockets::Utils.normalize_extension(ext)] = Tilt[ext] rescue LoadError # safely ignore... end end end end # Returns an `Array` of the child directories that # exist within the given +path+. If the path itself # does not exist, an emtpy array is returned. def self.existent_directories(path) pathname = Pathname.new path pathname.directory? or return [] pathname.children.select &:directory? end end end
Version data entries
6 entries across 6 versions & 1 rubygems