Sha256: c4ee6d87d69cb39678924296616b9a884de9bfe0b3dc65635333af763b6790c7
Contents?: true
Size: 721 Bytes
Versions: 3
Compression:
Stored size: 721 Bytes
Contents
module DocFace class FileTroll def troll(dir) if File.directory?(dir) index = Array.new path = dir.gsub(/\\(?=\S)/, '/') Dir.glob(File.join(path, '**/*.{md,MD,markdown,mdown}')).each do |file| index << file end index else puts "The directory #{dir} does not exist." exit end end def index_hash(list) tree = Hash.new list.sort.each do |w| h = tree w.split('/').each do |part| h = h[part] ||= Hash.new end end tree end def cleanup(h) return true if h.empty? h.find_all{|k,v|h[k]=nil if v.is_a?(Hash)&&cleanup(v)} false end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
docface-0.0.7 | lib/docface/file_troll.rb |
docface-0.0.6 | lib/docface/file_troll.rb |
docface-0.0.5 | lib/docface/file_troll.rb |