Class: AcosOpenApiHelper::SidebarMenu
- Inherits:
-
Object
- Object
- AcosOpenApiHelper::SidebarMenu
- Defined in:
- lib/acos_jekyll_openapi.rb
Constant Summary collapse
- @@entries =
Array.new
Class Method Summary collapse
-
.all_entries ⇒ Object
attr_accessor :title, :url.
Instance Method Summary collapse
- #add(entry) ⇒ Object
-
#initialize ⇒ SidebarMenu
constructor
A new instance of SidebarMenu.
- #write(output_path, name, menuTitle) ⇒ Object
Constructor Details
#initialize ⇒ SidebarMenu
105 106 107 108 109 |
# File 'lib/acos_jekyll_openapi.rb', line 105 def initialize() # @title = title # @url = url #@@entries << self end |
Class Method Details
.all_entries ⇒ Object
attr_accessor :title, :url
96 97 98 |
# File 'lib/acos_jekyll_openapi.rb', line 96 def self.all_entries @@entries end |
Instance Method Details
#add(entry) ⇒ Object
100 101 102 |
# File 'lib/acos_jekyll_openapi.rb', line 100 def add(entry) @@entries.push(entry) end |
#write(output_path, name, menuTitle) ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/acos_jekyll_openapi.rb', line 111 def write (output_path, name, ) _standardLines = [ "# This is your sidebar TOC. The sidebar code loops through sections here and provides the appropriate formatting.", "entries:", "- title: sidebar", " # product: Documentation", " # version: 1.0", " folders:", " - title: %s" % , " output: web", " type: frontmatter", " folderitems: " ] puts "Writing menu with length: %s" % @@entries.length @@entries.each do | item | puts "Entry: %s, url: %s" % [item.title, item.url] _standardLines << " - title: %s" % item.title _standardLines << " url: /%s.html" % item.url _standardLines << " output: web, pdf" end _standardLines << " - title: %s" % "Models" _standardLines << " url: /%s.html" % "userapi_components" _standardLines << " output: web, pdf" # File.open("%s/%s/%s/%s.%s" % [@basePath, "pages", "swagger", @permalink, "md"], "w+") do |f| # f.puts(@lines) # end puts "Writing menu file for %s at %s" % [name, output_path] File.open("%s/%s.%s" % [output_path, name, "yml"], "w+") do | f | f.puts(_standardLines) end end |