Class: Releaf::Content::RouterProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/releaf/content/router_proxy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_routeObject

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

#routerObject

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