Class: EventHub::DocsRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/eventhub/docs_renderer.rb

Constant Summary collapse

ASSETS_PATH =
File.expand_path("assets", __dir__)
TEMPLATES_PATH =
File.expand_path("templates", __dir__)
DEFAULT_README_LOCATIONS =
["README.md", "doc/README.md"].freeze
DEFAULT_CHANGELOG_LOCATIONS =
["CHANGELOG.md", "doc/CHANGELOG.md"].freeze
DEFAULT_COMPANY_NAME =
"Novartis"
DEFAULT_HTTP_RESOURCES =
[:heartbeat, :version, :docs, :changelog, :configuration].freeze

Instance Method Summary collapse

Constructor Details

#initialize(processor:, base_path:) ⇒ DocsRenderer



15
16
17
18
# File 'lib/eventhub/docs_renderer.rb', line 15

def initialize(processor:, base_path:)
  @processor = processor
  @base_path = base_path
end

Instance Method Details

#asset(name) ⇒ Object



35
36
37
38
39
# File 'lib/eventhub/docs_renderer.rb', line 35

def asset(name)
  path = File.join(ASSETS_PATH, name)
  return nil unless File.exist?(path)
  File.read(path)
end

#render_changelogObject



25
26
27
28
# File 'lib/eventhub/docs_renderer.rb', line 25

def render_changelog
  content = changelog_html
  render_layout(title: "CHANGELOG", content: content, content_class: "changelog")
end

#render_configObject



30
31
32
33
# File 'lib/eventhub/docs_renderer.rb', line 30

def render_config
  content = config_html
  render_layout(title: "Configuration", content: content, content_class: "config")
end

#render_readmeObject



20
21
22
23
# File 'lib/eventhub/docs_renderer.rb', line 20

def render_readme
  content = readme_html
  render_layout(title: "README", content: content, content_class: "")
end