Class: Www::Route

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pattern, request_methods, clazz) ⇒ Route

Returns a new instance of Route.



5
6
7
8
9
# File 'lib/www/route.rb', line 5

def initialize(pattern, request_methods, clazz)
  @pattern = "^#{pattern}$"
  @request_methods = [request_methods].flatten.map { |m| m.to_s.downcase.to_sym }
  @clazz = clazz
end

Instance Attribute Details

#clazzObject

Returns the value of attribute clazz.



4
5
6
# File 'lib/www/route.rb', line 4

def clazz
  @clazz
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/www/route.rb', line 4

def name
  @name
end

#patternObject

Returns the value of attribute pattern.



4
5
6
# File 'lib/www/route.rb', line 4

def pattern
  @pattern
end

#request_methodsObject

Returns the value of attribute request_methods.



4
5
6
# File 'lib/www/route.rb', line 4

def request_methods
  @request_methods
end

Instance Method Details

#inspectObject Also known as: to_s



11
12
13
# File 'lib/www/route.rb', line 11

def inspect
  "#<#{self.class}: #{pattern}, [#{request_methods.join(',')}] => #{clazz}##{name} >"
end