class Locomotive::Steam::Adapters::Filesystem::YAMLLoaders::Section

Public Instance Methods

load(scope) click to toggle source
# File lib/locomotive/steam/adapters/filesystem/yaml_loaders/section.rb, line 10
def load(scope)
  super
  load_list
end

Private Instance Methods

build(filepath, slug) click to toggle source
# File lib/locomotive/steam/adapters/filesystem/yaml_loaders/section.rb, line 35
def build(filepath, slug)
  {
    name:           slug.humanize,
    slug:           slug,
    template_path:  filepath
  }
end
load_file(filepath) click to toggle source
# File lib/locomotive/steam/adapters/filesystem/yaml_loaders/section.rb, line 23
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
load_list() click to toggle source
# File lib/locomotive/steam/adapters/filesystem/yaml_loaders/section.rb, line 17
def load_list
  Dir.glob(File.join(path, "*.{#{template_extensions.join(',')}}")).map do |filepath|
    load_file(filepath)
  end
end
path() click to toggle source
# File lib/locomotive/steam/adapters/filesystem/yaml_loaders/section.rb, line 43
def path
  @path ||= File.join(site_path, 'app', 'views', 'sections')
end