Sha256: 9592a9d60caa7d273942839bf284a98e2e65de1b5cbb7a25b84aead7c40e91dd
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
# frozen_string_literal: true module Nexmo module OAS module Renderer module Presenters class ApiSpecification def initialize(document_name:, code_language: nil) @document_name = document_name @code_language = code_language end def side_navigation "api/#{@document_name}" end def document_path "_api/#{@document_name}.md" end def document @document ||= File.read(document_path) end def frontmatter @frontmatter ||= YAML.safe_load(document) end def side_navigation_title @side_navigation_title ||= frontmatter.fetch('api') end def document_title @document_title ||= "#{side_navigation_title} > #{frontmatter.fetch('title')}" end def content options = {} options.merge(code_language: @code_language) if @code_language @content ||= Nexmo::Markdown::Renderer.new(options).call(document) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nexmo-oas-renderer-2.0.1 | lib/nexmo/oas/renderer/presenters/api_specification.rb |
nexmo-oas-renderer-2.0.0 | lib/nexmo/oas/renderer/presenters/api_specification.rb |