Sha256: 0b70df1b37d8279c33f83fdbb1048df50f15be19a4a17c10029bbda911c62867

Contents?: true

Size: 706 Bytes

Versions: 2

Compression:

Stored size: 706 Bytes

Contents

# frozen_string_literal: true

module Hanami
  class Router
    # Routes inspector
    #
    # @api private
    # @since 2.0.0
    class Inspector
      # @api private
      # @since 2.0.0
      def initialize(routes: [])
        @routes = routes
      end

      # @param route [Hash] serialized route
      #
      # @api private
      # @since 2.0.0
      def add_route(route)
        @routes.push(route)
      end

      # @return [String] The inspected routes
      #
      # @api private
      # @since 2.0.0
      def call(*)
        @routes.map(&:to_inspect).join(NEW_LINE)
      end

      # @api private
      # @since 2.0.0
      NEW_LINE = $/
      private_constant :NEW_LINE
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hanami-router-2.0.0.alpha6 lib/hanami/router/inspector.rb
hanami-router-2.0.0.alpha5 lib/hanami/router/inspector.rb