Class: Wytch::ContentLoader
- Inherits:
-
Object
- Object
- Wytch::ContentLoader
- Defined in:
- lib/wytch/content_loader.rb
Overview
Discovers and loads content files into Page objects.
The ContentLoader scans the content directory for Ruby files and instantiates Page objects for each one. It uses the configured page_class from the Site.
Instance Method Summary collapse
-
#load_content ⇒ Hash{String => Page}
Loads all content files and returns a hash of pages.
Instance Method Details
#load_content ⇒ Hash{String => Page}
Loads all content files and returns a hash of pages.
Scans the content directory recursively for .rb files, creates a Page instance for each, and returns them keyed by path.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/wytch/content_loader.rb', line 19 def load_content pages = {} Dir.glob(File.join("**", "*.rb"), base: content_dir).each do |file_path| page = load_page(file_path) pages[page.path] = page end pages end |