Sha256: f939a8994ea51fa3de057e0d4755a062bd92dbfc3d47f5bdd19b9b3cd9d798f2

Contents?: true

Size: 790 Bytes

Versions: 10

Compression:

Stored size: 790 Bytes

Contents

class Rack::App::Router::Static

  #TD
  attr_reader :endpoints

  def add_endpoint(request_method, request_path, endpoint)
    @endpoints[[request_method.to_s.upcase, Rack::App::Utils.normalize_path(request_path)]]= endpoint
  end

  def fetch_endpoint(request_method, request_path)
    @endpoints[[request_method, request_path]]
  end

  def merge!(static_router)
    raise(ArgumentError, "Invalid argument given, must be instance of a #{self.class.to_s}") unless static_router.is_a?(self.class)
    @endpoints.merge!(static_router.instance_variable_get(:@endpoints))
    nil
  end

  def show_endpoints
    @endpoints.map do |identifiers, endpoint|
      [identifiers, endpoint.properties[:description]].flatten
    end
  end

  protected

  def initialize
    @endpoints = {}
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rack-app-0.19.0 lib/rack/app/router/static.rb
rack-app-0.18.0 lib/rack/app/router/static.rb
rack-app-0.17.0 lib/rack/app/router/static.rb
rack-app-0.16.0 lib/rack/app/router/static.rb
rack-app-0.15.0 lib/rack/app/router/static.rb
rack-app-0.14.0 lib/rack/app/router/static.rb
rack-app-0.13.0 lib/rack/app/router/static.rb
rack-app-0.12.1 lib/rack/app/router/static.rb
rack-app-0.12.0 lib/rack/app/router/static.rb
rack-app-0.11.0 lib/rack/app/router/static.rb