Sha256: 96f27966f320b674d89c13f2bd4da45e6777ac6341f0a464ae558f65ba7dffd0
Contents?: true
Size: 615 Bytes
Versions: 2
Compression:
Stored size: 615 Bytes
Contents
class Servel::IndexView def initialize(url_path, fs_path) @url_path = url_path @fs_path = fs_path end def render(haml_context) haml_context.render('index.haml', locals) end def locals directories, files = @fs_path.children.partition { |child| child.directory? } { url_path: @url_path, fs_path: @fs_path, directories: sort_paths(directories), files: sort_paths(files), show_gallery: files.any? { |file| file.image? } } end def sort_paths(paths) Naturalsorter::Sorter.sort(paths.map(&:to_s), true).map { |path| Pathname.new(path) } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
servel-0.2.0 | lib/servel/index_view.rb |
servel-0.1.0 | lib/servel/index_view.rb |