module Sinatra::DocDsl
Attributes
page_doc[RW]
Public Instance Methods
doc_endpoint(path)
click to toggle source
# File lib/docdsl.rb, line 406 def doc_endpoint(path) @page_doc ||= PageDoc.new() page_doc=@page_doc get path do begin page_doc.render rescue Exception=>e [500,"#{e.message} #{e.backtrace.inspect}"] end end end
documentation(description,&block)
click to toggle source
# File lib/docdsl.rb, line 422 def documentation(description,&block) @page_doc ||= PageDoc.new @last_doc=DocEntry.new(description,&block) (@page_doc.entries ||= []) << @last_doc end
method_added(method)
click to toggle source
Calls superclass method
# File lib/docdsl.rb, line 428 def method_added(method) # gets called everytime a method is added to the app. # only triggers if the previous method was a documentation ... call if @last_doc @last_doc << method.to_s.sub(' ', " #{@page_doc.the_url_prefix}") @last_doc = nil end super end
page(&block)
click to toggle source
# File lib/docdsl.rb, line 418 def page(&block) @page_doc ||= PageDoc.new(&block) end