Class: GrapeDoc::Generator
- Inherits:
-
Object
- Object
- GrapeDoc::Generator
- Defined in:
- lib/grape/doc/generator.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #document ⇒ Object
-
#initialize(opts = {}) ⇒ Generator
constructor
A new instance of Generator.
- #save ⇒ Object (also: #save!)
Constructor Details
#initialize(opts = {}) ⇒ Generator
Returns a new instance of Generator.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/grape/doc/generator.rb', line 6 def initialize(opts={}) raise(ArgumentError,'invalid options given') unless opts.class <= Hash @options = { 'format' => 'html', 'path' => File.join(Helpers.doc_folder_path,'api_doc.html') }.merge(opts.reduce({}){|m,o| m.merge!(o[0].to_s => o[1]) ;m}) process_head process_table_of_content process_endpoints end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/grape/doc/generator.rb', line 5 def @options end |
Instance Method Details
#document ⇒ Object
20 21 22 |
# File 'lib/grape/doc/generator.rb', line 20 def document @api_doc ||= ApiDocumentation.new end |
#save ⇒ Object Also known as: save!
24 25 26 27 28 29 30 |
# File 'lib/grape/doc/generator.rb', line 24 def save File.write self.['path'], document.to_textile.to_html true;rescue;false end |