Sha256: c6162088705a92875e3471e9df188c05e14fd3709e69537e5c7b8aea239a87ad
Contents?: true
Size: 1.24 KB
Versions: 13
Compression:
Stored size: 1.24 KB
Contents
module Locomotive module Steam module Adapters module Filesystem module YAMLLoaders class Section include Adapters::Filesystem::YAMLLoader def load(scope) super load_list end private def load_list Dir.glob(File.join(path, "*.{#{template_extensions.join(',')}}")).map do |filepath| load_file(filepath) end end def load_file(filepath) slug = File.basename(filepath).split('.').first attributes = build(filepath, slug.permalink) _load(filepath, true, true) do |definition, template| attributes[:definition] = definition attributes[:template] = template end attributes end def build(filepath, slug) { name: slug.humanize, slug: slug, template_path: filepath } end def path @path ||= File.join(site_path, 'app', 'views', 'sections') end end end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems