Class: Kawaii::Routing::Route

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, http_method, mapping = nil, block = nil) ⇒ Route

Returns a new instance of Route.



4
5
6
7
8
9
# File 'lib/kawaii/routing/route.rb', line 4

def initialize(path, http_method, mapping = nil, block = nil)
  @path        = path
  @http_method = http_method
  @mapping     = mapping
  @handler     = route_handler(path, mapping, block)
end

Instance Attribute Details

#handlerObject (readonly)

Returns the value of attribute handler.



10
11
12
# File 'lib/kawaii/routing/route.rb', line 10

def handler
  @handler
end

#http_methodObject (readonly)

Returns the value of attribute http_method.



10
11
12
# File 'lib/kawaii/routing/route.rb', line 10

def http_method
  @http_method
end

#mappingObject (readonly)

Returns the value of attribute mapping.



10
11
12
# File 'lib/kawaii/routing/route.rb', line 10

def mapping
  @mapping
end

#pathObject (readonly)

Returns the value of attribute path.



10
11
12
# File 'lib/kawaii/routing/route.rb', line 10

def path
  @path
end

Instance Method Details

#==(other) ⇒ Object



12
13
14
# File 'lib/kawaii/routing/route.rb', line 12

def ==(other)
  path == other.path && http_method == other.http_method
end