Class: PDoc::Generators::JSON

Inherits:
AbstractGenerator show all
Defined in:
lib/pdoc/generators/json.rb

Instance Attribute Summary

Attributes inherited from AbstractGenerator

#options, #root

Instance Method Summary collapse

Methods inherited from AbstractGenerator

#initialize, #mkdir

Constructor Details

This class inherits a constructor from PDoc::Generators::AbstractGenerator

Instance Method Details

#render(output) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/pdoc/generators/json.rb', line 5

def render(output)
  open(output, "w+") do |file|
    json = root.registry.map do |k, obj|
      "#{k.inspect}: #{obj.to_json}"
    end.join(",\n  ")
    file << "{\n  #{json}\n}"
  end
end