Sha256: 6c654039a5922c301d1f04298d9bb117ba9e2919536534f5d13d96c96a8e3b59

Contents?: true

Size: 1.38 KB

Versions: 4

Compression:

Stored size: 1.38 KB

Contents

#:nodoc:
module Zen
  #:nodoc:
  module Plugin
    ##
    # Module that can be used to allows plugins to use data that would otherwise
    # only be available to controllers. Including this module gives your tags access to
    # the following methods:
    #
    # * request
    # * response
    # * session
    #
    # @author Yorick Peterse
    # @since  0.2.5
    #
    module Controller
      include ::Ramaze::Trinity
      
      ##
      # Returns the session data of the current node. This is a workaround for the
      # session() method not being available outside controllers.
      #
      # @author Yorick Peterse
      # @since  0.2.5
      # @return [Object]
      # 
      def session
        return action.node.session
      end
      
      ##
      # Returns the request data of the current node. This is a workaround for the
      # request() method not being available outside controllers.
      #
      # @author Yorick Peterse
      # @since  0.2.5
      # @return [Object]
      # 
      def request
        return action.node.request
      end
      
      ##
      # Returns the response data of the current node. This is a workaround for the
      # response() method not being available outside controllers.
      #
      # @author Yorick Peterse
      # @since  0.2.5
      # @return [Object]
      # 
      def response
        return action.node.response
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
zen-0.2.7 lib/zen/plugin/controller.rb
zen-0.2.6.1 lib/zen/plugin/controller.rb
zen-0.2.6 lib/zen/plugin/controller.rb
zen-0.2.5 lib/zen/plugin/controller.rb