class GrapeMarkdown::Route
Public Instance Methods
list?()
click to toggle source
# File lib/grape-markdown/route.rb, line 56 def list? request_method == 'GET' && !path.include?(':id') end
root_resource()
click to toggle source
# File lib/grape-markdown/route.rb, line 13 def root_resource namespace.split('/').reject(&:empty?).first end
root_resource_title()
click to toggle source
# File lib/grape-markdown/route.rb, line 17 def root_resource_title root_resource.titleize end
route_binding()
click to toggle source
# File lib/grape-markdown/route.rb, line 60 def route_binding binding end
route_name()
click to toggle source
# File lib/grape-markdown/route.rb, line 27 def route_name namespace.split('/').last || route_path.match('\/(\w*?)[\.\/\(]').captures.first end
route_params()
click to toggle source
# File lib/grape-markdown/route.rb, line 21 def route_params @route_params ||= __getobj__.params.sort.map do |param| Parameter.new(self, *param) end end
route_path_without_format()
click to toggle source
# File lib/grape-markdown/route.rb, line 48 def route_path_without_format path.gsub(/\((.*?)\)/, '') end
route_short_description()
click to toggle source
# File lib/grape-markdown/route.rb, line 36 def route_short_description description = <<-DESCRIPTION.gsub(/^\s*/, '').gsub(/\n/, ' ').squeeze #{request_method.titleize} a #{list? ? 'list of ' : ' '} #{list? ? route_title : route_title.singularize} DESCRIPTION description << "on a #{root_resource_title.singularize}" if parent? description end
route_title()
click to toggle source
# File lib/grape-markdown/route.rb, line 32 def route_title route_name.titleize end
route_type()
click to toggle source
# File lib/grape-markdown/route.rb, line 52 def route_type list? ? 'collection' : 'single' end
Private Instance Methods
parent?()
click to toggle source
# File lib/grape-markdown/route.rb, line 70 def parent? route_name != root_resource end
request_body?()
click to toggle source
# File lib/grape-markdown/route.rb, line 66 def request_body? !%w(GET DELETE).include?(request_method) end