Method: Fdoc::SchemaPresenter#to_html

Defined in:
lib/fdoc/presenters/schema_presenter.rb

#to_htmlObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/fdoc/presenters/schema_presenter.rb', line 30

def to_html
  html = StringIO.new

  html << '<span class="deprecated">Deprecated</span>' if deprecated?

  html << '<div class="schema">'
  html << render_markdown(@schema["description"])

  html << '<ul>'
  begin
    html << '<li>Required: %s</li>' % required? if nested?
    html << '<li>Type: %s</li>' % type if type
    html << '<li>Format: %s</li>' % format if format
    html << '<li>Example: %s</li>' % example.to_html if example
    html << enum_html

    (@schema.keys - FORMATTED_KEYS).each do |key|
      html << '<li>%s: %s</li>' % [ key, @schema[key] ]
    end

    html << items_html
    html << properties_html
  end


  html << '</ul>'
  html << '</div>'

  html.string
end