Class: ThemeLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/rdoc/generator/theme_loader.rb

Overview

ThemeLoader reads theme files from ‘.yml’ files and builds a hash that will be passed to HTML template or written to JSON file, and a list of theme files to be installed along with the HTML file.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ThemeLoader

Returns a new instance of ThemeLoader.



19
20
21
# File 'lib/rdoc/generator/theme_loader.rb', line 19

def initialize(options)
  @options = options
end

Class Method Details

.theme_path(name) ⇒ Object



15
16
17
# File 'lib/rdoc/generator/theme_loader.rb', line 15

def self.theme_path(name)
  Settings.find_file 'themes', '.yml', name
end

.themes_listObject



11
12
13
# File 'lib/rdoc/generator/theme_loader.rb', line 11

def self.themes_list
  Settings.list_file_names 'themes', '.yml'
end

Instance Method Details

#loadObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/rdoc/generator/theme_loader.rb', line 23

def load
  theme = {
    head: {
      styles:  [],
      fonts:   [],
      scripts: [],
      html:    []
    },
    body: {
      header: [],
      footer: []
    }
  }

  theme_files = []

  @options.sf_themes.each do |theme_path|
    load_theme(theme, theme_files, theme_path)
  end

  build_files(theme_files)

  [theme, theme_files]
end