Sha256: 4841d2d0b6551429455d4430bcdf5b553603717e1da13400a3953159ff2ccf18
Contents?: true
Size: 894 Bytes
Versions: 3
Compression:
Stored size: 894 Bytes
Contents
module SectionsRails module ViewFinder # Returns an array with the file name of all views in the given directory. # Views are all files that end in .html.erb def self.find_all_views root result = [] Dir.entries(root).each do |view_file| next if ['.', '..', '.gitkeep'].include? view_file next if view_file[-4..-1] == '.swp' full_path = "#{root}/#{view_file}" if File.directory? full_path result.concat find_all_views(full_path) else result << full_path end end result end # Used for :prepare_pages. Not used right now. def self.parse_views views result = {} views_to_parse.each do |view_to_parse| view_text = IO.read(File.join root, view_to_parse) result[view_to_parse] = find_sections_in_text view_text end result end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sections_rails-0.7.1 | lib/sections_rails/view_finder.rb |
sections_rails-0.7.0 | lib/sections_rails/view_finder.rb |
sections_rails-0.6.12 | lib/sections_rails/view_finder.rb |