class RspecApiDocumentation::Writers::JsonIodocsWriter

Attributes

api_key[RW]

Public Class Methods

new(index, configuration) click to toggle source
Calls superclass method
# File lib/rspec_api_documentation/writers/json_iodocs_writer.rb, line 9
def initialize(index, configuration)
  super
  self.api_key = configuration.api_name.parameterize
end

Public Instance Methods

write() click to toggle source
# File lib/rspec_api_documentation/writers/json_iodocs_writer.rb, line 14
def write
  File.open(docs_dir.join("apiconfig.json"), "w+") do |file|
    file.write Formatter.to_json(ApiConfig.new(configuration))
  end
  File.open(docs_dir.join("#{api_key}.json"), "w+") do |file|
    file.write Formatter.to_json(JsonIndex.new(index, configuration))
  end
end