Class: Midori::Route

Inherits:
Object
  • Object
show all
Defined in:
lib/midori/route.rb

Overview

Class for Midori route

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, path, function) ⇒ Route

Define a route

Parameters:

  • method (String)

    HTTP method

  • path (Regexp)

    regex to match

  • function (Proc)

    what to do after matched



14
15
16
17
18
19
# File 'lib/midori/route.rb', line 14

def initialize(method, path, function)
  @method = method
  @path = path
  @function = function
  @middlewares = []
end

Instance Attribute Details

#functionProc

what to do after matched

Returns:

  • (Proc)

    the current value of function



7
8
9
# File 'lib/midori/route.rb', line 7

def function
  @function
end

#methodString

HTTP method

Returns:

  • (String)

    the current value of method



7
8
9
# File 'lib/midori/route.rb', line 7

def method
  @method
end

#middlewaresArray<Class>

middlewares used in the route

Returns:

  • (Array<Class>)

    the current value of middlewares



7
8
9
# File 'lib/midori/route.rb', line 7

def middlewares
  @middlewares
end

#pathRegexp

regex to match

Returns:

  • (Regexp)

    the current value of path



7
8
9
# File 'lib/midori/route.rb', line 7

def path
  @path
end