Class: Maglev::ThemeFilesystemLoader
- Inherits:
-
Object
- Object
- Maglev::ThemeFilesystemLoader
- Defined in:
- lib/maglev/theme_filesystem_loader.rb
Instance Attribute Summary collapse
-
#fetch_section_screenshot_path ⇒ Object
readonly
Returns the value of attribute fetch_section_screenshot_path.
Instance Method Summary collapse
- #call(path) ⇒ Object
-
#initialize(fetch_section_screenshot_path) ⇒ ThemeFilesystemLoader
constructor
A new instance of ThemeFilesystemLoader.
Constructor Details
#initialize(fetch_section_screenshot_path) ⇒ ThemeFilesystemLoader
Returns a new instance of ThemeFilesystemLoader.
7 8 9 |
# File 'lib/maglev/theme_filesystem_loader.rb', line 7 def initialize(fetch_section_screenshot_path) @fetch_section_screenshot_path = fetch_section_screenshot_path end |
Instance Attribute Details
#fetch_section_screenshot_path ⇒ Object (readonly)
Returns the value of attribute fetch_section_screenshot_path.
5 6 7 |
# File 'lib/maglev/theme_filesystem_loader.rb', line 5 def fetch_section_screenshot_path @fetch_section_screenshot_path end |
Instance Method Details
#call(path) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/maglev/theme_filesystem_loader.rb', line 11 def call(path) theme = add(YAML.safe_load(File.read(path.join('theme.yml')), aliases: true)) sections = load_sections(theme, Pathname.new(path).join('sections/**/*.yml')) theme.sections = Maglev::Section::Store.new(sections) theme rescue Errno::ENOENT log_missing_theme_file(path) end |