Class: RspecApiDocumentation::Writers::JsonIodocsWriter
- Defined in:
- lib/rspec_api_documentation/writers/json_iodocs_writer.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
Attributes inherited from Writer
Instance Method Summary collapse
-
#initialize(index, configuration) ⇒ JsonIodocsWriter
constructor
A new instance of JsonIodocsWriter.
- #write ⇒ Object
Methods inherited from Writer
Constructor Details
#initialize(index, configuration) ⇒ JsonIodocsWriter
Returns a new instance of JsonIodocsWriter.
9 10 11 12 |
# 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 |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
6 7 8 |
# File 'lib/rspec_api_documentation/writers/json_iodocs_writer.rb', line 6 def api_key @api_key end |
Instance Method Details
#write ⇒ Object
14 15 16 17 18 19 20 21 |
# 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 |