module HaveAPI::Server::DocHelpers
Public Instance Methods
Source
# File lib/haveapi/server.rb, line 177 def escape_html(v) return '' if v.nil? CGI.escapeHTML(v.to_s) end
Source
# File lib/haveapi/server.rb, line 155 def format_param_type(param) return param[:type] if param[:type] != 'Resource' "<a href=\"#root-#{param[:resource].join('-')}-show\">#{param[:type]}</a>" end
Source
# File lib/haveapi/server.rb, line 161 def format_validators(validators) ret = '' return ret if validators.nil? validators.each do |name, opts| ret += "<h5>#{name.to_s.capitalize}</h5>" ret += '<dl>' opts.each do |k, v| ret += "<dt>#{k}</dt><dd>#{escape_html(v.to_s)}</dd>" end ret += '</dl>' end ret end