Module: Relay::Concerns::Roda
- Included in:
- Pages::Base, Routes::Base
- Defined in:
- app/concerns/roda.rb
Overview
Shared Roda integration for Relay page and route base classes.
This concern stores the current Roda instance, exposes the request object as ‘r`, and delegates unknown helper calls back to Roda so pages and routes can use methods like `view`, `partial`, `session`, `request`, and `response` without re-defining that plumbing.
Instance Method Summary collapse
- #initialize(roda) ⇒ void
-
#method_missing(name, *args, **kwargs, &block) ⇒ Object
Delegates missing methods to the current Roda instance.
-
#r ⇒ Roda::RodaRequest
Alias the request object as ‘r` to match Roda route blocks.
-
#respond_to_missing?(name, include_private = false) ⇒ Boolean
Returns true when the current Roda instance can respond to a delegated method.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, **kwargs, &block) ⇒ Object
Delegates missing methods to the current Roda instance.
32 33 34 35 36 37 38 |
# File 'app/concerns/roda.rb', line 32 def method_missing(name, *args, **kwargs, &block) if @roda.respond_to?(name) @roda.send(name, *args, **kwargs, &block) else super end end |
Instance Method Details
#initialize(roda) ⇒ void
15 16 17 |
# File 'app/concerns/roda.rb', line 15 def initialize(roda) @roda = roda end |
#r ⇒ Roda::RodaRequest
Returns Alias the request object as ‘r` to match Roda route blocks.
22 23 24 |
# File 'app/concerns/roda.rb', line 22 def r @roda.request end |
#respond_to_missing?(name, include_private = false) ⇒ Boolean
Returns true when the current Roda instance can respond to a delegated method.
46 47 48 |
# File 'app/concerns/roda.rb', line 46 def respond_to_missing?(name, include_private = false) @roda.respond_to?(name) || super end |