Sha256: 6101d2be59224696bd4d2507fe8215f7bda6e038ab3a0b98c6f0c1e339649bc7

Contents?: true

Size: 1.13 KB

Versions: 5

Compression:

Stored size: 1.13 KB

Contents

module Vedeu

  # Provides methods to be used by Vedeu::ApplicationController.
  #
  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]
      # @todo This event binding should be: `Vedeu.bind(:show_view, name)`.
      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

5 entries across 5 versions & 1 rubygems

Version Path
vedeu-0.4.61 lib/vedeu/application/controller.rb
vedeu-0.4.60 lib/vedeu/application/controller.rb
vedeu-0.4.59 lib/vedeu/application/controller.rb
vedeu-0.4.58 lib/vedeu/application/controller.rb
vedeu-0.4.57 lib/vedeu/application/controller.rb