Sha256: f0b999d1d089a3553a80b4bfa5dbd851e9847615b2a7b718401c04f60b74cb50

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

module Vedeu

  # Provides methods to be used by Vedeu::ApplicationController.
  #
  # @api private
  module Controller

    # When included, provide these methods as class methods.
    module ClassMethods

      # Specifying the controller name in your controller provides a Vedeu event
      # which will trigger the loading of the controller.
      #
      # @example
      #   class YourController
      #     controller_name :your_controller
      #     # ...
      #   end
      #
      #   Vedeu.trigger(:show_your_controller) # this event is now available to
      #                                        # trigger.
      #
      # @param name [Symbol] The name of the controller.
      # @return [void]
      def controller_name(name)
        Vedeu.bind("show_#{name}".to_sym) { new }
      end

    end # ClassMethods

    # When this module is included in a class, provide ClassMethods as class
    # methods for the class.
    #
    # @param klass [Class]
    # @return [void]
    def self.included(klass)
      klass.send :extend, ClassMethods
    end

  end # Controller

end # Vedeu

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.4.45 lib/vedeu/application/controller.rb