Class: Twke::Routes::RoutePrefix
- Inherits:
-
Object
- Object
- Twke::Routes::RoutePrefix
- Defined in:
- lib/twke/routes.rb
Instance Method Summary collapse
-
#initialize(str = nil) ⇒ RoutePrefix
constructor
A new instance of RoutePrefix.
- #method_missing(name, &blk) ⇒ Object
- #route(str, *opts, &blk) ⇒ Object
Constructor Details
#initialize(str = nil) ⇒ RoutePrefix
Returns a new instance of RoutePrefix.
4 5 6 7 |
# File 'lib/twke/routes.rb', line 4 def initialize(str = nil) @levels = [] @levels.push(str) if str end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, &blk) ⇒ Object
15 16 17 18 19 |
# File 'lib/twke/routes.rb', line 15 def method_missing(name, &blk) @levels.push(name) yield @levels.pop end |