Sha256: 8615903e2873b1e6df02a4522e05a0675150f8c1436c45a2cdae75c9679db4f0

Contents?: true

Size: 941 Bytes

Versions: 4

Compression:

Stored size: 941 Bytes

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|
                slug = File.basename(filepath).split('.').first
                build(filepath, slug.permalink)
              end
            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

4 entries across 4 versions & 1 rubygems

Version Path
locomotivecms_steam-1.5.0.rc0 lib/locomotive/steam/adapters/filesystem/yaml_loaders/section.rb
locomotivecms_steam-1.5.0.beta3 lib/locomotive/steam/adapters/filesystem/yaml_loaders/section.rb
locomotivecms_steam-1.5.0.beta2 lib/locomotive/steam/adapters/filesystem/yaml_loaders/section.rb
locomotivecms_steam-1.5.0.beta1 lib/locomotive/steam/adapters/filesystem/yaml_loaders/section.rb