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, RedirectEndpoint

Instance Method Summary collapse

Instance Method Details

#destination_pathObject

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:

  • 1.0.1


65
66
# File 'lib/hanami/routing/endpoint.rb', line 65

def destination_path
end

#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


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

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

    "#<[email protected]#{ ::File.expand_path(source) }:#{ line }#{ lambda_inspector }>"
  when Class
    __getobj__
  else
    "#<#{ __getobj__.class }>"
  end
end

#redirect?Boolean

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.

Returns:

  • (Boolean)

Since:

  • 1.0.1


59
60
61
# File 'lib/hanami/routing/endpoint.rb', line 59

def redirect?
  false
end

#routable?Boolean

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.

Returns:

  • (Boolean)

Since:

  • 1.0.0


52
53
54
55
# File 'lib/hanami/routing/endpoint.rb', line 52

def routable?
  !__getobj__.nil?
rescue ArgumentError
end