Sha256: 5752ec1ba276c6189f1b021cea590ea5d54fb7d625c9fb101dcdbddb55355692

Contents?: true

Size: 1.23 KB

Versions: 6

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

module Vedeu

  # Provides methods which should be available to all client
  # application controllers. The client application's
  # ApplicationController will inherit from this class.
  #
  class ApplicationController

    include Vedeu::Controller

    # Returns a new instance of Vedeu::ApplicationController.
    #
    # @param params [Hash] The named parameters provided to the
    #   controller which will be used by the actions within the
    #   controller.
    # @return [Vedeu::ApplicationController]
    def initialize(**params)
      @params = params
    end

    # @param controller [Symbol] The name of controller to be
    #   redirected to.
    # @param action [Symbol] The name of the action within the
    #   controller to be called.
    # @param params [Hash] Any named parameter which need to be passed
    #   to the action.
    def redirect_to(controller, action, **params)
      Vedeu.trigger(:_goto_, controller, action, params)
    end
    alias_method :redirect, :redirect_to
    alias_method :goto, :redirect_to

    protected

    # @!attribute [rw] params
    # @return [Hash] The named parameters passed to the controller.
    attr_accessor :params

  end # ApplicationController

end # Vedeu

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vedeu-0.8.6 lib/vedeu/application/application_controller.rb
vedeu-0.8.5 lib/vedeu/application/application_controller.rb
vedeu-0.8.4 lib/vedeu/application/application_controller.rb
vedeu-0.8.3 lib/vedeu/application/application_controller.rb
vedeu-0.8.2 lib/vedeu/application/application_controller.rb
vedeu-0.8.1 lib/vedeu/application/application_controller.rb