Class: Espago::Router
- Inherits:
-
Object
- Object
- Espago::Router
- Defined in:
- lib/espago/router.rb
Constant Summary collapse
- NoPathError =
Class.new(StandardError)
Instance Attribute Summary collapse
-
#method ⇒ Object
Returns the value of attribute method.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path, method) ⇒ Router
constructor
A new instance of Router.
- #path_exists? ⇒ Boolean
- #route ⇒ Object
Constructor Details
#initialize(path, method) ⇒ Router
Returns a new instance of Router.
8 9 10 |
# File 'lib/espago/router.rb', line 8 def initialize(path, method) @path, @method = path, method end |
Instance Attribute Details
#method ⇒ Object
Returns the value of attribute method.
5 6 7 |
# File 'lib/espago/router.rb', line 5 def method @method end |
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/espago/router.rb', line 5 def path @path end |
Instance Method Details
#path_exists? ⇒ Boolean
17 18 19 20 21 22 |
# File 'lib/espago/router.rb', line 17 def path_exists? get_route true rescue false end |
#route ⇒ Object
12 13 14 15 |
# File 'lib/espago/router.rb', line 12 def route raise NoPathError unless path_exists? get_route end |