Class: Releaf::Content::RouterProxy
- Inherits:
-
Object
- Object
- Releaf::Content::RouterProxy
- Defined in:
- lib/releaf/content/router_proxy.rb
Instance Attribute Summary collapse
-
#releaf_route ⇒ Object
Returns the value of attribute releaf_route.
-
#router ⇒ Object
Returns the value of attribute router.
Instance Method Summary collapse
- #draw(&block) ⇒ Object
-
#initialize(router, releaf_route) ⇒ RouterProxy
constructor
A new instance of RouterProxy.
- #method_missing(method_name, *args, &block) ⇒ Object
Constructor Details
#initialize(router, releaf_route) ⇒ RouterProxy
Returns a new instance of RouterProxy.
5 6 7 8 |
# File 'lib/releaf/content/router_proxy.rb', line 5 def initialize(router, releaf_route) self.router = router self.releaf_route = releaf_route end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/releaf/content/router_proxy.rb', line 14 def method_missing(method_name, *args, &block) if router.respond_to?(method_name) router.public_send(method_name, *releaf_route.params(*args), &block) else super end end |
Instance Attribute Details
#releaf_route ⇒ Object
Returns the value of attribute releaf_route.
3 4 5 |
# File 'lib/releaf/content/router_proxy.rb', line 3 def releaf_route @releaf_route end |
#router ⇒ Object
Returns the value of attribute router.
3 4 5 |
# File 'lib/releaf/content/router_proxy.rb', line 3 def router @router end |
Instance Method Details
#draw(&block) ⇒ Object
10 11 12 |
# File 'lib/releaf/content/router_proxy.rb', line 10 def draw(&block) instance_exec(releaf_route, &block) end |