Class: Hanami::Routing::Endpoint Private

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/hanami/routing/endpoint.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Routing endpoint This is the object that responds to an HTTP request made against a certain path.

The router will use this class for:

* Procs and any Rack compatible object (respond to #call)

Examples:

require 'hanami/router'

Hanami::Router.new do
  get '/proc',     to: ->(env) { [200, {}, ['This will use Hanami::Routing::Endpoint']] }
  get '/rack-app', to: RackApp.new
end

Since:

  • 0.1.0

Direct Known Subclasses

ClassEndpoint, LazyEndpoint

Instance Method Summary collapse

Instance Method Details

#inspectObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.2.0



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/hanami/routing/endpoint.rb', line 35

def inspect
  case __getobj__
  when Proc
    source, line     = __getobj__.source_location
    lambda_inspector = " (lambda)"  if  __getobj__.lambda?

    "#<Proc@#{ ::File.expand_path(source) }:#{ line }#{ lambda_inspector }>"
  when Class
    __getobj__
  else
    "#<#{ __getobj__.class }>"
  end
end