Module: HaveAPI::Server::DocHelpers
- Defined in:
- lib/haveapi/server.rb
Instance Method Summary collapse
Instance Method Details
#escape_html(v) ⇒ Object
186 187 188 189 190 |
# File 'lib/haveapi/server.rb', line 186 def escape_html(v) return '' if v.nil? CGI.escapeHTML(v.to_s) end |
#format_param_type(param) ⇒ Object
164 165 166 167 168 |
# File 'lib/haveapi/server.rb', line 164 def format_param_type(param) return param[:type] if param[:type] != 'Resource' "<a href=\"#root-#{param[:resource].join('-')}-show\">#{param[:type]}</a>" end |
#format_validators(validators) ⇒ Object
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/haveapi/server.rb', line 170 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 |