Module: HaveAPI::Server::DocHelpers

Defined in:
lib/haveapi/server.rb

Instance Method Summary collapse

Instance Method Details

#format_param_type(param) ⇒ Object



155
156
157
158
159
# 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

#format_validators(validators) ⇒ Object



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# 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>#{v}</dd>"
    end
    ret += '</dl>'
  end

  ret
end