Module: Deris::PartialHasher
Instance Method Summary collapse
Instance Method Details
#partials_hash ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/partial_hasher.rb', line 5 def partials_hash unless respond_to?(:directory) raise 'need to response to "directory" to create a hash of partials' end partials = {} partial_file_mask = ::File.join(directory, '*.haml') partial_files = ::Dir.glob(partial_file_mask) partial_files.each do |file| file_sym = ::File.basename(file, '.haml').to_sym partials[file_sym] = ::File.new(file).read end partials end |