Module: Jazzy::DocumentationGenerator

Extended by:
Config::Mixin
Defined in:
lib/jazzy/documentation_generator.rb

Class Method Summary collapse

Methods included from Config::Mixin

config

Class Method Details

.documentation_entriesObject



32
33
34
35
36
# File 'lib/jazzy/documentation_generator.rb', line 32

def self.documentation_entries
  return [] unless
    config.documentation_glob_configured && config.documentation_glob
  config.documentation_glob.select { |e| File.file? e }
end

.overview(file_path) ⇒ Object



27
28
29
30
# File 'lib/jazzy/documentation_generator.rb', line 27

def self.overview(file_path)
  return '' unless file_path && file_path.exist?
  file_path.read
end

.source_docsObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/jazzy/documentation_generator.rb', line 10

def self.source_docs
  documentation_entries.map do |file_path|
    SourceDocument.new.tap do |sd|
      sd.name = File.basename(file_path, '.md')
      sd.url = sd.name.downcase.strip
                 .tr(' ', '-').gsub(/[^\w-]/, '') + '.html'
      sd.type = SourceDeclaration::Type.new 'document.markdown'
      sd.children = []
      sd.overview = overview Pathname(file_path)
      sd.usr = 'documentation.' + sd.name
      sd.abstract = ''
      sd.return = ''
      sd.parameters = []
    end
  end
end