module RocketDocs

Constants

VERSION

Attributes

description[RW]
title[RW]
url[RW]

Public Class Methods

config(&block) click to toggle source
# File lib/rocket_docs.rb, line 14
def config(&block)
  block.call(self)
end
documentation() click to toggle source
# File lib/rocket_docs.rb, line 18
def documentation
  Router.api_full.map do |version, controller|
    Documentation.new(version, controller)
  end
end
documentation_for_files(files, version_name = 'Unknown') click to toggle source
# File lib/rocket_docs.rb, line 28
def documentation_for_files(files, version_name = 'Unknown')
  fake_controlers = files.map do |file|
    fake_controller = {
      path: file,
      actions: Hash[
        Parser.method_comments(file).keys.map { |m, _c| [m, []] }
      ]
    }
    [File.basename(file, '.rb'), fake_controller]
  end
  Documentation.new(version_name, Hash[fake_controlers])
end
documentation_for_version(version) click to toggle source
# File lib/rocket_docs.rb, line 24
def documentation_for_version(version)
  Documentation.new(version.to_i, Router.api_full[version.to_i])
end
format_string(string) click to toggle source
# File lib/rocket_docs.rb, line 41
def format_string(string)
  return unless string
  CGI.escapeHTML(string).gsub("\n", '<br>').html_safe
end