Module: Roda::RodaPlugins::Delegate::ClassMethods

Defined in:
lib/roda/plugins/delegate.rb

Instance Method Summary collapse

Instance Method Details

#class_delegate(*meths) ⇒ Object

Delegate the given methods to the class



52
53
54
55
56
# File 'lib/roda/plugins/delegate.rb', line 52

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



59
60
61
62
63
# File 'lib/roda/plugins/delegate.rb', line 59

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



66
67
68
69
70
# File 'lib/roda/plugins/delegate.rb', line 66

def response_delegate(*meths)
  meths.each do |meth|
    define_method(meth){|*a, &block| @_response.send(meth, *a, &block)}
  end
end