Sha256: 795b2a0707df3ae26bcd8235a3a93acb5f9ca45952094ad91905c545a249bc91

Contents?: true

Size: 837 Bytes

Versions: 2

Compression:

Stored size: 837 Bytes

Contents

module GrapeRouteHelpers
  # class for displaying the path, helper method name,
  # and required arguments for every Grape::Route.
  class RouteDisplayer
    def route_attributes
      Grape::API.decorated_routes.map do |route|
        {
          route_path: route.route_path,
          helper_names: route.helper_names,
          helper_arguments: route.helper_arguments
        }
      end
    end

    def display
      puts("== GRAPE ROUTE HELPERS ==\n\n")
      route_attributes.each do |attributes|
        printf("%s: %s\n", 'Path', attributes[:route_path])
        printf("%s: %s\n",
               'Helper Method',
               attributes[:helper_names].join(', '))
        printf("%s: %s\n",
               'Arguments',
               attributes[:helper_arguments].join(', '))
        puts("\n")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
grape-route-helpers-1.0.1 lib/grape-route-helpers/route_displayer.rb
grape-route-helpers-1.0.0 lib/grape-route-helpers/route_displayer.rb