Module: Roda::RodaPlugins::Delegate::ClassMethods
- Defined in:
- lib/roda/plugins/delegate.rb
Instance Method Summary collapse
-
#class_delegate(*meths) ⇒ Object
Delegate the given methods to the class.
-
#request_delegate(*meths) ⇒ Object
Delegate the given methods to the request.
-
#response_delegate(*meths) ⇒ Object
Delegate the given methods to the response.
Instance Method Details
#class_delegate(*meths) ⇒ Object
Delegate the given methods to the class
50 51 52 53 54 |
# File 'lib/roda/plugins/delegate.rb', line 50 def class_delegate(*meths) meths.each do |meth| define_method(meth){|*a, &block| self.class.send(meth, *a, &block)} end end |
#request_delegate(*meths) ⇒ Object
Delegate the given methods to the request
57 58 59 60 61 |
# File 'lib/roda/plugins/delegate.rb', line 57 def request_delegate(*meths) meths.each do |meth| define_method(meth){|*a, &block| @_request.send(meth, *a, &block)} end end |
#response_delegate(*meths) ⇒ Object
Delegate the given methods to the response
64 65 66 67 68 |
# File 'lib/roda/plugins/delegate.rb', line 64 def response_delegate(*meths) meths.each do |meth| define_method(meth){|*a, &block| @_response.send(meth, *a, &block)} end end |