diff --git a/lib/noosfero/plugin/context.rb b/lib/noosfero/plugin/context.rb index 58d464d..1f8f92e 100644 --- a/lib/noosfero/plugin/context.rb +++ b/lib/noosfero/plugin/context.rb @@ -1,37 +1,15 @@ +# This class defines the interface to important context information from the +# controller that can be accessed by plugins class Noosfero::Plugin::Context def initialize(controller) @controller = controller end - # Here the developer should define the interface to important context - # information from the controller to the plugins to access - def profile - @profile ||= @controller.send(:profile) - end - - def request - @request ||= @controller.send(:request) - end + delegate :profile, :request, :response, :environment, :params, :session, :user, :to => :controller - def response - @response ||= @controller.send(:response) - end - - def environment - @environment ||= @controller.send(:environment) - end + protected - def params - @params ||= @controller.send(:params) - end - - def session - @session ||= @controller.send(:session) - end - - def user - @user ||= @controller.send(:user) - end + attr_reader :controller end -- libgit2 0.21.2