Sha256: 12cb2e4fb5728f04e4b1f62f8ed7fb73e659a22ebcbf08933bfdb65ca992a5a6

Contents?: true

Size: 1.15 KB

Versions: 11

Compression:

Stored size: 1.15 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]
      # @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

11 entries across 11 versions & 1 rubygems

Version Path
vedeu-0.4.56 lib/vedeu/application/controller.rb
vedeu-0.4.55 lib/vedeu/application/controller.rb
vedeu-0.4.54 lib/vedeu/application/controller.rb
vedeu-0.4.53 lib/vedeu/application/controller.rb
vedeu-0.4.52 lib/vedeu/application/controller.rb
vedeu-0.4.51 lib/vedeu/application/controller.rb
vedeu-0.4.50 lib/vedeu/application/controller.rb
vedeu-0.4.49 lib/vedeu/application/controller.rb
vedeu-0.4.48 lib/vedeu/application/controller.rb
vedeu-0.4.47 lib/vedeu/application/controller.rb
vedeu-0.4.46 lib/vedeu/application/controller.rb