class Sinatra::Chiro::Documentation
Attributes
endpoints[R]
Public Class Methods
new(endpoints)
click to toggle source
# File lib/sinatra/chiro/document.rb, line 7 def initialize(endpoints) @endpoints = endpoints end
Public Instance Methods
document(env)
click to toggle source
# File lib/sinatra/chiro/document.rb, line 11 def document(env) _, path = env['sinatra.route'].split endpoint = endpoints.select { |d| d.path == path}.flatten.first raise "Path #{path} doesn't have any docs" unless endpoint [[endpoints[0].appname, [endpoint]]] end
routes()
click to toggle source
# File lib/sinatra/chiro/document.rb, line 18 def routes [endpoints[0].appname, endpoints] end