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



47
48
49
50
51
# File 'lib/roda/plugins/delegate.rb', line 47

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



54
55
56
57
58
# File 'lib/roda/plugins/delegate.rb', line 54

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



61
62
63
64
65
# File 'lib/roda/plugins/delegate.rb', line 61

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