Class: Trane::Docs::HtmlRenderer
- Inherits:
-
Object
- Object
- Trane::Docs::HtmlRenderer
- Defined in:
- lib/trane/docs/html_renderer.rb
Constant Summary collapse
- METHOD_COLORS =
{ "GET" => "#61affe", "POST" => "#49cc90", "PUT" => "#fca130", "PATCH" => "#fca130", "DELETE" => "#f93e3e" }.freeze
- TEMPLATE_PATH =
File.("templates/index.html.erb", __dir__)
- TEMPLATE =
ERB.new(File.read(TEMPLATE_PATH), trim_mode: "-").freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(definition) ⇒ HtmlRenderer
constructor
A new instance of HtmlRenderer.
- #to_html ⇒ Object
Constructor Details
#initialize(definition) ⇒ HtmlRenderer
Returns a new instance of HtmlRenderer.
23 24 25 |
# File 'lib/trane/docs/html_renderer.rb', line 23 def initialize(definition) @definition = definition end |
Class Method Details
.render(definition) ⇒ Object
19 20 21 |
# File 'lib/trane/docs/html_renderer.rb', line 19 def self.render(definition) new(definition).to_html end |
Instance Method Details
#to_html ⇒ Object
27 28 29 |
# File 'lib/trane/docs/html_renderer.rb', line 27 def to_html TEMPLATE.result(binding) end |