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
53 54 55 56 57 |
# File 'lib/roda/plugins/delegate.rb', line 53 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
60 61 62 63 64 |
# File 'lib/roda/plugins/delegate.rb', line 60 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
67 68 69 70 71 |
# File 'lib/roda/plugins/delegate.rb', line 67 def response_delegate(*meths) meths.each do |meth| define_method(meth){|*a, &block| @_response.send(meth, *a, &block)} end end |