Class: Www::Route
- Inherits:
-
Object
- Object
- Www::Route
- Defined in:
- lib/www/route.rb
Instance Attribute Summary collapse
-
#clazz ⇒ Object
Returns the value of attribute clazz.
-
#name ⇒ Object
Returns the value of attribute name.
-
#pattern ⇒ Object
Returns the value of attribute pattern.
-
#request_methods ⇒ Object
Returns the value of attribute request_methods.
Instance Method Summary collapse
-
#initialize(pattern, request_methods, clazz) ⇒ Route
constructor
A new instance of Route.
- #inspect ⇒ Object (also: #to_s)
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
#clazz ⇒ Object
Returns the value of attribute clazz.
4 5 6 |
# File 'lib/www/route.rb', line 4 def clazz @clazz end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/www/route.rb', line 4 def name @name end |
#pattern ⇒ Object
Returns the value of attribute pattern.
4 5 6 |
# File 'lib/www/route.rb', line 4 def pattern @pattern end |
#request_methods ⇒ Object
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
#inspect ⇒ Object 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 |