class Angus::SDoc::HtmlFormatter
Constants
- ENGLISH_LANG
Public Class Methods
format_service(service_definition, language = nil)
click to toggle source
Generates the html for the service definition.
@param [Angus::SDoc::Definitions::Service] service_definition the service definition. @param [String] language The language to user for the documentation, defaults to english
@return [String] the generated html.
# File lib/angus/sdoc/html_formatter.rb, line 15 def self.format_service(service_definition, language = nil) @service = service_definition @language = language || ENGLISH_LANG erb(:doc, @language) end
Private Class Methods
erb(template, language = nil)
click to toggle source
# File lib/angus/sdoc/html_formatter.rb, line 22 def self.erb(template, language = nil) template_name = if language "#{template}.#{language}.erb" else "#{template}.erb" end template = File.open(File.join(templates_path, template_name)).read ERB.new(template).result(binding) end
h_type(type, service)
click to toggle source
# File lib/angus/sdoc/html_formatter.rb, line 39 def self.h_type(type, service) if service.representations_hash.include?(type) "<a href='#representation-#{service.representations_hash[type].name}'>#{type}</a>" else type end end
operation_path(operation)
click to toggle source
# File lib/angus/sdoc/html_formatter.rb, line 34 def self.operation_path(operation) "/#{@service.code_name}/api/#{@service.version}#{operation.path}" end
templates_path()
click to toggle source
# File lib/angus/sdoc/html_formatter.rb, line 48 def self.templates_path File.join(File.dirname(__FILE__), 'templates') end