Sha256: 755572d20accd2a2c99d34b927d2d8f9548558da82c5e7d32131057209622c5b

Contents?: true

Size: 508 Bytes

Versions: 1

Compression:

Stored size: 508 Bytes

Contents

namespace :mountapi do
  desc "List routes registered by MountAPI"
  task routes: :environment do
    routes = Mountapi.router.routes.map do |route|
      path, method, handler, id = route.raw_value << route.operation_id

      [id.rjust(20), path.ljust(30), method.to_s.ljust(30), handler.to_s.ljust(30)].join(" ")
    end

    routes.unshift(
      ["Operation ID".rjust(20), "Path".ljust(30), "Method".ljust(30), "Handler".ljust(30)].join(" "),
      "-" * 120
    )

    puts routes.join("\n")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mountapi-0.11.1 lib/tasks/routes.rake